enh azure plugins, add tags on list modes
This commit is contained in:
parent
a89c774a5c
commit
f42b9d807c
|
@ -67,8 +67,14 @@ sub run {
|
|||
my $resource_group = '-';
|
||||
$resource_group = $vm->{resourceGroup} if (defined($vm->{resourceGroup}));
|
||||
$resource_group = $1 if (defined($vm->{id}) && $vm->{id} =~ /resourceGroups\/(.*)\/providers/);
|
||||
|
||||
my @tags;
|
||||
foreach my $tag (keys %{$vm->{tags}}) {
|
||||
push @tags, $tag . ':' . $vm->{tags}->{$tag};
|
||||
}
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][computername = %s][resourcegroup = %s]" .
|
||||
"[location = %s][vmid = %s][vmsize = %s][os = %s][state = %s]",
|
||||
"[location = %s][vmid = %s][vmsize = %s][os = %s][state = %s][tags = %s]",
|
||||
$vm->{name},
|
||||
$computer_name,
|
||||
$resource_group,
|
||||
|
@ -77,6 +83,7 @@ sub run {
|
|||
(defined($vm->{properties}->{hardwareProfile}->{vmSize})) ? $vm->{properties}->{hardwareProfile}->{vmSize} : $vm->{hardwareProfile}->{vmSize},
|
||||
(defined($vm->{properties}->{storageProfile}->{osDisk}->{osType})) ? $vm->{properties}->{storageProfile}->{osDisk}->{osType} : $vm->{storageProfile}->{osDisk}->{osType},
|
||||
(defined($vm->{powerState})) ? $vm->{powerState} : "-",
|
||||
join(',', @tags),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -89,7 +96,7 @@ sub run {
|
|||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements => ['name', 'computername', 'resourcegroup', 'location', 'vmid', 'vmsize', 'os', 'state']);
|
||||
$self->{output}->add_disco_format(elements => ['name', 'computername', 'resourcegroup', 'location', 'vmid', 'vmsize', 'os', 'state', 'tags']);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
|
@ -103,6 +110,12 @@ sub disco_show {
|
|||
my $resource_group = '-';
|
||||
$resource_group = $vm->{resourceGroup} if (defined($vm->{resourceGroup}));
|
||||
$resource_group = $1 if (defined($vm->{id}) && $vm->{id} =~ /resourceGroups\/(.*)\/providers/);
|
||||
|
||||
my @tags;
|
||||
foreach my $tag (keys %{$vm->{tags}}) {
|
||||
push @tags, $tag . ':' . $vm->{tags}->{$tag};
|
||||
}
|
||||
|
||||
$self->{output}->add_disco_entry(
|
||||
name => $vm->{name},
|
||||
computername => $computer_name,
|
||||
|
@ -112,6 +125,7 @@ sub disco_show {
|
|||
vmsize => (defined($vm->{properties}->{hardwareProfile}->{vmSize})) ? $vm->{properties}->{hardwareProfile}->{vmSize} : $vm->{hardwareProfile}->{vmSize},
|
||||
os => (defined($vm->{properties}->{storageProfile}->{osDisk}->{osType})) ? $vm->{properties}->{storageProfile}->{osDisk}->{osType} : $vm->{storageProfile}->{osDisk}->{osType},
|
||||
state => (defined($vm->{powerState})) ? $vm->{powerState} : "-",
|
||||
tags => join(',', @tags),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -60,8 +60,14 @@ sub run {
|
|||
&& $group->{name} !~ /$self->{option_results}->{filter_name}/);
|
||||
next if (defined($self->{option_results}->{location}) && $self->{option_results}->{location} ne ''
|
||||
&& $group->{location} !~ /$self->{option_results}->{location}/);
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][location = %s][id = %s]",
|
||||
$group->{name}, $group->{location}, $group->{id}));
|
||||
|
||||
my @tags;
|
||||
foreach my $tag (keys %{$group->{tags}}) {
|
||||
push @tags, $tag . ':' . $group->{tags}->{$tag};
|
||||
}
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][location = %s][id = %s][tags = %s]",
|
||||
$group->{name}, $group->{location}, $group->{id}, join(',', @tags)));
|
||||
}
|
||||
|
||||
$self->{output}->output_add(severity => 'OK',
|
||||
|
@ -73,7 +79,7 @@ sub run {
|
|||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements => ['name', 'location', 'id']);
|
||||
$self->{output}->add_disco_format(elements => ['name', 'location', 'id', 'tags']);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
|
@ -81,10 +87,16 @@ sub disco_show {
|
|||
|
||||
$self->manage_selection(%options);
|
||||
foreach my $group (@{$self->{groups}}) {
|
||||
my @tags;
|
||||
foreach my $tag (keys %{$group->{tags}}) {
|
||||
push @tags, $tag . ':' . $group->{tags}->{$tag};
|
||||
}
|
||||
|
||||
$self->{output}->add_disco_entry(
|
||||
name => $group->{name},
|
||||
location => $group->{location},
|
||||
id => $group->{id},
|
||||
tags => join(',', @tags),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,12 +70,19 @@ sub run {
|
|||
my $resource_group = '-';
|
||||
$resource_group = $resource->{resourceGroup} if (defined($resource->{resourceGroup}));
|
||||
$resource_group = $1 if (defined($resource->{id}) && $resource->{id} =~ /resourceGroups\/(.*)\/providers/);
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][resourcegroup = %s][location = %s][id = %s][type = %s]",
|
||||
|
||||
my @tags;
|
||||
foreach my $tag (keys %{$resource->{tags}}) {
|
||||
push @tags, $tag . ':' . $resource->{tags}->{$tag};
|
||||
}
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][resourcegroup = %s][location = %s][id = %s][type = %s][tags = %s]",
|
||||
$resource->{name},
|
||||
$resource_group,
|
||||
$resource->{location},
|
||||
$resource->{id},
|
||||
$resource->{type}
|
||||
$resource->{type},
|
||||
join(',', @tags),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -88,7 +95,7 @@ sub run {
|
|||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements => ['name', 'resourcegroup', 'location', 'id', 'type']);
|
||||
$self->{output}->add_disco_format(elements => ['name', 'resourcegroup', 'location', 'id', 'type', 'tags']);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
|
@ -99,12 +106,19 @@ sub disco_show {
|
|||
my $resource_group = '-';
|
||||
$resource_group = $resource->{resourceGroup} if (defined($resource->{resourceGroup}));
|
||||
$resource_group = $1 if (defined($resource->{id}) && $resource->{id} =~ /resourceGroups\/(.*)\/providers/);
|
||||
|
||||
my @tags;
|
||||
foreach my $tag (keys %{$resource->{tags}}) {
|
||||
push @tags, $tag . ':' . $resource->{tags}->{$tag};
|
||||
}
|
||||
|
||||
$self->{output}->add_disco_entry(
|
||||
name => $resource->{name},
|
||||
resourcegroup => $resource_group,
|
||||
location => $resource->{location},
|
||||
id => $resource->{id},
|
||||
type => $resource->{type},
|
||||
tags => join(',', @tags),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,11 +67,18 @@ sub run {
|
|||
my $resource_group = '-';
|
||||
$resource_group = $resource->{resourceGroup} if (defined($resource->{resourceGroup}));
|
||||
$resource_group = $1 if (defined($resource->{id}) && $resource->{id} =~ /resourceGroups\/(.*)\/providers/);
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][resourcegroup = %s][location = %s][id = %s]",
|
||||
|
||||
my @tags;
|
||||
foreach my $tag (keys %{$resource->{tags}}) {
|
||||
push @tags, $tag . ':' . $resource->{tags}->{$tag};
|
||||
}
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][resourcegroup = %s][location = %s][id = %s][tags = %s]",
|
||||
$resource->{name},
|
||||
$resource_group,
|
||||
$resource->{location},
|
||||
$resource->{id}
|
||||
$resource->{id},
|
||||
join(',', @tags),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -84,7 +91,7 @@ sub run {
|
|||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements => ['name', 'resourcegroup', 'location', 'id']);
|
||||
$self->{output}->add_disco_format(elements => ['name', 'resourcegroup', 'location', 'id', 'tags']);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
|
@ -95,11 +102,18 @@ sub disco_show {
|
|||
my $resource_group = '-';
|
||||
$resource_group = $resource->{resourceGroup} if (defined($resource->{resourceGroup}));
|
||||
$resource_group = $1 if (defined($resource->{id}) && $resource->{id} =~ /resourceGroups\/(.*)\/providers/);
|
||||
|
||||
my @tags;
|
||||
foreach my $tag (keys %{$resource->{tags}}) {
|
||||
push @tags, $tag . ':' . $resource->{tags}->{$tag};
|
||||
}
|
||||
|
||||
$self->{output}->add_disco_entry(
|
||||
name => $resource->{name},
|
||||
resourcegroup => $resource_group,
|
||||
location => $resource->{location},
|
||||
id => $resource->{id},
|
||||
tags => join(',', @tags),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -67,11 +67,18 @@ sub run {
|
|||
my $resource_group = '-';
|
||||
$resource_group = $resource->{resourceGroup} if (defined($resource->{resourceGroup}));
|
||||
$resource_group = $1 if (defined($resource->{id}) && $resource->{id} =~ /resourceGroups\/(.*)\/providers/);
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][resourcegroup = %s][location = %s][id = %s]",
|
||||
|
||||
my @tags;
|
||||
foreach my $tag (keys %{$resource->{tags}}) {
|
||||
push @tags, $tag . ':' . $resource->{tags}->{$tag};
|
||||
}
|
||||
|
||||
$self->{output}->output_add(long_msg => sprintf("[name = %s][resourcegroup = %s][location = %s][id = %s][tags = %s]",
|
||||
$resource->{name},
|
||||
$resource_group,
|
||||
$resource->{location},
|
||||
$resource->{id}
|
||||
$resource->{id},
|
||||
join(',', @tags),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -84,7 +91,7 @@ sub run {
|
|||
sub disco_format {
|
||||
my ($self, %options) = @_;
|
||||
|
||||
$self->{output}->add_disco_format(elements => ['name', 'resourcegroup', 'location', 'id']);
|
||||
$self->{output}->add_disco_format(elements => ['name', 'resourcegroup', 'location', 'id', 'tags']);
|
||||
}
|
||||
|
||||
sub disco_show {
|
||||
|
@ -95,11 +102,18 @@ sub disco_show {
|
|||
my $resource_group = '-';
|
||||
$resource_group = $resource->{resourceGroup} if (defined($resource->{resourceGroup}));
|
||||
$resource_group = $1 if (defined($resource->{id}) && $resource->{id} =~ /resourceGroups\/(.*)\/providers/);
|
||||
|
||||
my @tags;
|
||||
foreach my $tag (keys %{$resource->{tags}}) {
|
||||
push @tags, $tag . ':' . $resource->{tags}->{$tag};
|
||||
}
|
||||
|
||||
$self->{output}->add_disco_entry(
|
||||
name => $resource->{name},
|
||||
resourcegroup => $resource_group,
|
||||
location => $resource->{location},
|
||||
id => $resource->{id},
|
||||
tags => join(',', @tags),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue