enh(azure/acr): add discovery mode (#3255)
This commit is contained in:
parent
04c0368b0e
commit
8681442e1e
|
@ -0,0 +1,60 @@
|
|||
#
|
||||
# Copyright 2021 Centreon (http://www.centreon.com/)
|
||||
#
|
||||
# Centreon is a full-fledged industry-strength solution that meets
|
||||
# the needs in IT infrastructure and application monitoring for
|
||||
# service performance.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
package cloud::azure::storage::acr::mode::discovery;
|
||||
|
||||
use base qw(cloud::azure::management::monitor::mode::discovery);
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
sub check_options {
|
||||
my ($self, %options) = @_;
|
||||
$self->SUPER::check_options(%options);
|
||||
|
||||
$self->{namespace} = 'Microsoft.ContainerRegistry';
|
||||
$self->{type} = 'registries';
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
__END__
|
||||
|
||||
=head1 MODE
|
||||
|
||||
Discover Azure Storage Container Registry resources.
|
||||
|
||||
=over 8
|
||||
|
||||
=item B<--resource-group>
|
||||
|
||||
Specify resource group.
|
||||
|
||||
=item B<--location>
|
||||
|
||||
Specify location.
|
||||
|
||||
=item B<--prettify>
|
||||
|
||||
Prettify JSON output.
|
||||
|
||||
=back
|
||||
|
||||
=cut
|
|
@ -66,7 +66,7 @@ sub check_options {
|
|||
}
|
||||
my $resource = $self->{option_results}->{resource};
|
||||
my $resource_group = defined($self->{option_results}->{resource_group}) ? $self->{option_results}->{resource_group} : '';
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.containerregistry\/registries\/(.*)$/) {
|
||||
if ($resource =~ /^\/subscriptions\/.*\/resourceGroups\/(.*)\/providers\/Microsoft\.ContainerRegistry\/registries\/(.*)$/) {
|
||||
$resource_group = $1;
|
||||
$resource = $2;
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ sub check_options {
|
|||
$self->{az_resource} = $resource;
|
||||
$self->{az_resource_group} = $resource_group;
|
||||
$self->{az_resource_type} = 'registries';
|
||||
$self->{az_resource_namespace} = 'microsoft.containerregistry';
|
||||
$self->{az_resource_namespace} = 'Microsoft.ContainerRegistry';
|
||||
$self->{az_timeframe} = defined($self->{option_results}->{timeframe}) ? $self->{option_results}->{timeframe} : 3600;
|
||||
$self->{az_interval} = defined($self->{option_results}->{interval}) ? $self->{option_results}->{interval} : 'PT1H';
|
||||
$self->{az_aggregations} = ['average'];
|
||||
|
|
|
@ -31,6 +31,7 @@ sub new {
|
|||
|
||||
$self->{version} = '0.1';
|
||||
$self->{modes} = {
|
||||
'discovery' => 'cloud::azure::storage::acr::mode::discovery',
|
||||
'storage-usage' => 'cloud::azure::storage::acr::mode::storageusage'
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue