| 1 | package VMware::API::vCloud; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use LWP; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use XML::Simple; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||
| 10 | 2 | $VMware::API::vCloud::VERSION = '2.404'; | |||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | # ADMIN OPTS - http://www.vmware.com/support/vcd/doc/rest-api-doc-1.5-html/landing-admin_operations.html | ||||||||||||||||||||||||||||||||
| 13 | # USER OPTS - http://www.vmware.com/support/vcd/doc/rest-api-doc-1.5-html/landing-user_operations.html | ||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | =head1 NAME | ||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | VMware::API::vCloud - The VMware vCloud API | ||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||
| 19 | =head1 SYNOPSIS | ||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | my $api = new VMware::API::vCloud ( | ||||||||||||||||||||||||||||||||
| 23 | $hostname, $username, $password, $orgname | ||||||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||
| 26 | my $raw_login_data = $vcd->login; | ||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||
| 28 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | This module provides a bare interface to VMware's vCloud REST API. | ||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||
| 32 | VMware::vCloud is designed for high level usage with vCloud Director. This | ||||||||||||||||||||||||||||||||
| 33 | module, however, provides a more low-level access to the REST interface. | ||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||
| 35 | Responses received from vCloud are in XML. They are translated via XML::Simple | ||||||||||||||||||||||||||||||||
| 36 | with ForceArray set for consistency in nesting. This is the object returned. | ||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||
| 38 | Aside from the translation of XML into a perl data structure, no further | ||||||||||||||||||||||||||||||||
| 39 | alteration is performed on the data. | ||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||
| 41 | HTTP errors are automatically parsed and die() is called. If you need to perform | ||||||||||||||||||||||||||||||||
| 42 | a dangerous action, do so in an eval block and evaluate $@. | ||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||
| 44 | =head1 OBJECT METHODS | ||||||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||||||
| 46 | These methods are not API calls. They represent the methods that create | ||||||||||||||||||||||||||||||||
| 47 | this module as a "wrapper" for the vCloud API. | ||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||
| 49 | =head2 new() | ||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||
| 51 | This method creates the vCloud object. | ||||||||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||||||
| 53 | Arguments | ||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||
| 55 | =over 4 | ||||||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||||||
| 57 | =item * hostname | ||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||
| 59 | =item * username | ||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||
| 61 | =item * password | ||||||||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||||||
| 63 | =item * organization | ||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||
| 65 | =back | ||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||
| 67 | =cut | ||||||||||||||||||||||||||||||||
| 68 | |||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | sub new { | ||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||
| 70 | 0 | my $class = shift @_; | |||||||||||||||||||||||||||||||
| 71 | 0 | my $self = {}; | |||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||
| 73 | 0 | $self->{hostname} = shift @_; | |||||||||||||||||||||||||||||||
| 74 | 0 | $self->{username} = shift @_; | |||||||||||||||||||||||||||||||
| 75 | 0 | $self->{password} = shift @_; | |||||||||||||||||||||||||||||||
| 76 | 0 | $self->{orgname} = shift @_; | |||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||
| 78 | 0 | $self->{debug} = 0; # Defaults to no debug info | |||||||||||||||||||||||||||||||
| 79 | 0 | $self->{die_on_fault} = 1; # Defaults to dieing on an error | |||||||||||||||||||||||||||||||
| 80 | 0 | $self->{ssl_timeout} = 3600; # Defaults to 1h | |||||||||||||||||||||||||||||||
| 81 | |||||||||||||||||||||||||||||||||
| 82 | 0 | ▶ | $self->{orgname} = 'System' unless $self->{orgname}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 83 | |||||||||||||||||||||||||||||||||
| 84 | 0 | ▶ | $self->{conf} = shift @_ if defined $_[0] and ref $_[0]; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $_[0] and ref $_[0]
MC/DC0%0/2
defined $_[0] and ref $_[0]
defined $_[0]
ref $_[0]
Truth table0%0/3
A and B
A= defined $_[0]B= ref $_[0]
| |||||||||||||||||||||||||||||||||
| 85 | 0 | ▶ | $self->{debug} = $self->{conf}->{debug} if defined $self->{conf}->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||
| 87 | 0 | bless($self,$class); | |||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||
| 89 | 0 | $self->_regenerate(); | |||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | $self->_debug("Loaded VMware::vCloud v" . our $VERSION . "\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 92 | 0 | return $self; | |||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||
| 94 | |||||||||||||||||||||||||||||||||
| 95 | =head2 config() | ||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||
| 97 | $vcd->config( debug => 1 ); | ||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||
| 99 | =over 4 | ||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||
| 101 | =item debug | ||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||
| 103 | 0 for no debugging. | ||||||||||||||||||||||||||||||||
| 104 | 1 to turn on basic debug messages. | ||||||||||||||||||||||||||||||||
| 105 | 2 to display learned variables on exit. | ||||||||||||||||||||||||||||||||
| 106 | 3 to show all XML transactions. | ||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||
| 108 | =item die_on_fault - 1 to cause the program to die verbosely on a soap fault. 0 for the fault object to be returned on the call and for die() to not be called. Defaults to 1. If you choose not to die_on_fault (for example, if you are writing a CGI) you will want to check all return objects to see if they are fault objects or not. | ||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||
| 110 | =item ssl_timeout - seconds to wait for timeout. Defaults to 3600. (1hr) This is how long a transaction response will be waited for once submitted. For slow storage systems and full clones, you may want to up this higher. If you find yourself setting this to more than 6 hours, your vCloud setup is probably not in the best shape. | ||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||
| 112 | =item hostname, orgname, username and password - All of these values can be changed from the original settings on new(). This is handing for performing multiple transactions across organizations. | ||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||
| 114 | =back | ||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||
| 116 | =cut | ||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | sub config { | ||||||||||||||||||||||||||||||
|
Subroutine
config: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 119 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||
| 121 | 0 | my %input = @_; | |||||||||||||||||||||||||||||||
| 122 | 0 | my @config_vals = qw/debug die_on_fault hostname orgname password ssl_timeout username/; | |||||||||||||||||||||||||||||||
| 123 | 0 | my %config_vals = map { $_,1; } @config_vals; | |||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||
| 125 | 0 | for my $key ( keys %input ) { | |||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | if ( $config_vals{$key} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 127 | 0 | $self->{$key} = $input{$key}; | |||||||||||||||||||||||||||||||
| 128 | } else { | ||||||||||||||||||||||||||||||||
| 129 | 0 | warn 'Config key "$key" is being ignored. Only the following options may be configured: ' | |||||||||||||||||||||||||||||||
| 130 | . join(", ", @config_vals ) . "\n"; | ||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||
| 134 | 0 | $self->_regenerate(); | |||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||
| 136 | 0 | my %out; | |||||||||||||||||||||||||||||||
| 137 | 0 | map { $out{$_} = $self->{$_} } @config_vals; | |||||||||||||||||||||||||||||||
| 138 | |||||||||||||||||||||||||||||||||
| 139 | 0 | ▶ | return wantarray ? %out : \%out; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||
| 142 | ### Internal methods | ||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||
| 144 | # $self->{raw}->{version} - Full data on the API version from login (populated on api_version() call) | ||||||||||||||||||||||||||||||||
| 145 | # $self->{raw}->{login} | ||||||||||||||||||||||||||||||||
| 146 | # $self->{learned}->{version} - API version number (populated on api_version() call) | ||||||||||||||||||||||||||||||||
| 147 | # $self->{learned}->{url}->{login} - Authentication URL (populated on api_version() call) | ||||||||||||||||||||||||||||||||
| 148 | # $self->{learned}->{url}->{orglist} | ||||||||||||||||||||||||||||||||
| 149 | |||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 151 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 152 | 0 | my @dump = split "\n", Dumper($self->{learned}); | |||||||||||||||||||||||||||||||
| 153 | 0 | pop @dump; shift @dump; | |||||||||||||||||||||||||||||||
| 154 | 0 | $self->_debug_with_level(2,"Learned variables: \n" . join("\n",@dump)); | |||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | sub _debug { | ||||||||||||||||||||||||||||||
|
Subroutine
_debug: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||
| 158 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 159 | 0 | ▶ | return undef unless $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 160 | 0 | ▶ | while ( my $debug = shift @_ ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 161 | 0 | chomp $debug; | |||||||||||||||||||||||||||||||
| 162 | 0 | print STDERR "DEBUG: $debug\n"; | |||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | sub _debug_with_level { | ||||||||||||||||||||||||||||||
|
Subroutine
_debug_with_level: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||
| 167 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 168 | 0 | my $value = shift @_; | |||||||||||||||||||||||||||||||
| 169 | 0 | ▶ | return undef if $self->{debug} < $value; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 170 | 0 | $self->_debug(@_); | |||||||||||||||||||||||||||||||
| 171 | } | ||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | sub _fault { | ||||||||||||||||||||||||||||||
|
Subroutine
_fault: not called CC=7 SCAR=40.3
| |||||||||||||||||||||||||||||||||
| 174 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 175 | 0 | my @error = @_; | |||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||
| 177 | 0 | my $message = "\nERROR: "; | |||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||
| 179 | 0 | ▶ | if ( length(@error) and ref $error[0] eq 'HTTP::Response' ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
length @error and ref $error[0] eq "HTTP::Response"
MC/DC0%0/2
length @error and ref $error[0] eq "HTTP::Response"
length @error
ref $error[0] eq "HTTP::Response"
Truth table0%0/3
A and B
A= length @errorB= ref $error[0] eq "HTTP::Response"
| |||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | if ( $error[0]->content ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 181 | 0 | $self->_debug(Dumper(\@error)); | |||||||||||||||||||||||||||||||
| 182 | 0 | $self->_debug('ERROR Status Line: ' . $error[0]->status_line); | |||||||||||||||||||||||||||||||
| 183 | 0 | $self->_debug('ERROR Content: ' . $error[0]->content); | |||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||
| 185 | 0 | my $ret; # Try parsing as XML, or fallback to content as message | |||||||||||||||||||||||||||||||
| 186 | 0 | eval { $ret = $self->_parse_xml($error[0]->content); }; | |||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | $message .= ( $@ ? $error[0]->content : $error[0]->status_line . ' : '. $ret->{message} ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 188 | } | ||||||||||||||||||||||||||||||||
| 189 | 0 | die $message; | |||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | while ( my $error = shift @error ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | if ( ref $error eq 'SCALAR' ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 194 | 0 | chomp $error; | |||||||||||||||||||||||||||||||
| 195 | 0 | $message .= $error; | |||||||||||||||||||||||||||||||
| 196 | } else { | ||||||||||||||||||||||||||||||||
| 197 | 0 | $message .= Dumper($error); | |||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||
| 200 | } | ||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||
| 202 | 0 | ▶ | sub _regenerate { | ||||||||||||||||||||||||||||||
|
Subroutine
_regenerate: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 203 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 204 | 0 | $self->{ua} = LWP::UserAgent->new; | |||||||||||||||||||||||||||||||
| 205 | 0 | $self->_debug_with_level(2,"VMware::API::vCLoud::_regenerate()"); | |||||||||||||||||||||||||||||||
| 206 | |||||||||||||||||||||||||||||||||
| 207 | 0 | $self->{api_version} = $self->api_version(); | |||||||||||||||||||||||||||||||
| 208 | 0 | $self->_debug("API Version: $self->{api_version}"); | |||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||
| 210 | 0 | $self->{url_base} = URI->new('https://'. $self->{hostname} .'/api/v'. $self->{api_version} .'/'); | |||||||||||||||||||||||||||||||
| 211 | 0 | $self->_debug("API URL: $self->{url_base}"); | |||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | sub _xml_response { | ||||||||||||||||||||||||||||||
|
Subroutine
_xml_response: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||
| 215 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 216 | 0 | my $response = shift @_; | |||||||||||||||||||||||||||||||
| 217 | 0 | $self->_debug_with_level(3,"Received XML Content: \n\n" . $response->content . "\n\n"); | |||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | if ( $response->is_success ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | return undef unless $response->content; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 220 | 0 | return $self->_parse_xml( $response->content ); | |||||||||||||||||||||||||||||||
| 221 | } else { | ||||||||||||||||||||||||||||||||
| 222 | 0 | $self->_fault($response); | |||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | sub _parse_xml { | ||||||||||||||||||||||||||||||
|
Subroutine
_parse_xml: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||
| 227 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 228 | 0 | my $xml = shift @_; | |||||||||||||||||||||||||||||||
| 229 | 0 | my $data = XMLin( $xml, KeyAttr => [ qw(id) ], ForceArray => 1, ); | |||||||||||||||||||||||||||||||
| 230 | 0 | return $data; | |||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||
| 233 | =head1 REST METHODS | ||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||
| 235 | These are direct access to the REST web methods. | ||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||
| 237 | =head2 delete($url) | ||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||
| 239 | Performs a DELETE action on the given URL, and returns the parsed XML response. | ||||||||||||||||||||||||||||||||
| 240 | |||||||||||||||||||||||||||||||||
| 241 | =cut | ||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | sub delete { | ||||||||||||||||||||||||||||||
|
Subroutine
delete: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 244 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 245 | 0 | my $url = shift @_; | |||||||||||||||||||||||||||||||
| 246 | 0 | ▶ | $self->_debug("API: delete($url)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 247 | 0 | my $req = HTTP::Request->new( DELETE => $url ); | |||||||||||||||||||||||||||||||
| 248 | 0 | $req->header( Accept => $self->{learned}->{accept_header} ); | |||||||||||||||||||||||||||||||
| 249 | 0 | my $response = $self->{ua}->request($req); | |||||||||||||||||||||||||||||||
| 250 | 0 | return $self->_xml_response($response); | |||||||||||||||||||||||||||||||
| 251 | } | ||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||
| 253 | =head2 get($url) | ||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||
| 255 | Performs a GET action on the given URL, and returns the parsed XML response. | ||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||
| 257 | =cut | ||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||
| 259 | 0 | ▶ | sub get { | ||||||||||||||||||||||||||||||
|
Subroutine
get: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 260 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 261 | 0 | my $url = shift @_; | |||||||||||||||||||||||||||||||
| 262 | 0 | ▶ | $self->_debug("API: get($url)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 263 | 0 | my $req = HTTP::Request->new( GET => $url ); | |||||||||||||||||||||||||||||||
| 264 | 0 | $req->header( Accept => $self->{learned}->{accept_header} ); | |||||||||||||||||||||||||||||||
| 265 | #$self->_debug_with_level(3,"Sending GET: \n\n" . $req->as_string . "\n"); | ||||||||||||||||||||||||||||||||
| 266 | 0 | my $response = $self->{ua}->request($req); | |||||||||||||||||||||||||||||||
| 267 | 0 | my $check = $response->request; | |||||||||||||||||||||||||||||||
| 268 | 0 | $self->_debug_with_level(3,"Sent GET:\n\n" . $check->as_string . "\n"); | |||||||||||||||||||||||||||||||
| 269 | 0 | $self->_debug_with_level(3,"GET returned:\n\n" . $response->as_string . "\n"); | |||||||||||||||||||||||||||||||
| 270 | 0 | return $self->_xml_response($response); | |||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||
| 272 | |||||||||||||||||||||||||||||||||
| 273 | =head2 get_raw($url) | ||||||||||||||||||||||||||||||||
| 274 | |||||||||||||||||||||||||||||||||
| 275 | Performs a GET action on the given URL, and returns the unparsed HTTP::Request object. | ||||||||||||||||||||||||||||||||
| 276 | |||||||||||||||||||||||||||||||||
| 277 | =cut | ||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | sub get_raw { | ||||||||||||||||||||||||||||||
|
Subroutine
get_raw: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 280 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 281 | 0 | my $url = shift @_; | |||||||||||||||||||||||||||||||
| 282 | 0 | ▶ | $self->_debug("API: get($url)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 283 | 0 | my $req = HTTP::Request->new( GET => $url ); | |||||||||||||||||||||||||||||||
| 284 | 0 | $req->header( Accept => $self->{learned}->{accept_header} ); | |||||||||||||||||||||||||||||||
| 285 | #$self->_debug_with_level(3,"Sending GET: \n\n" . $req->as_string . "\n"); | ||||||||||||||||||||||||||||||||
| 286 | 0 | my $response = $self->{ua}->request($req); | |||||||||||||||||||||||||||||||
| 287 | 0 | my $check = $response->request; | |||||||||||||||||||||||||||||||
| 288 | 0 | $self->_debug_with_level(3,"Sent GET:\n\n" . $check->as_string . "\n"); | |||||||||||||||||||||||||||||||
| 289 | 0 | $self->_debug_with_level(3,"GET returned:\n\n" . $response->as_string . "\n"); | |||||||||||||||||||||||||||||||
| 290 | 0 | return $response->content; | |||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||
| 293 | =head2 post($url,$type,$content) | ||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||
| 295 | Performs a POST action on the given URL, and returns the parsed XML response. | ||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||
| 297 | The optional value for $type is set as the Content Type for the transaction. | ||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||
| 299 | The optional value for $content is used as the content of the post. | ||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||
| 301 | =cut | ||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||
| 303 | 0 | ▶ | sub post { | ||||||||||||||||||||||||||||||
|
Subroutine
post: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 304 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 305 | 0 | my $href = shift @_; | |||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||
| 307 | 0 | my $type = shift @_; | |||||||||||||||||||||||||||||||
| 308 | 0 | my $content = shift @_; | |||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | $self->_debug("API: post($href)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 311 | 0 | my $req = HTTP::Request->new( POST => $href ); | |||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||
| 313 | 0 | ▶ | $req->content($content) if $content; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | $req->content_type($type) if $type; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 315 | 0 | $req->header( Accept => $self->{learned}->{accept_header} ); | |||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||
| 317 | 0 | $self->_debug_with_level(3,"Posting with XML Content-Type: $type","Posting XML content:\n\n$content\n\n"); | |||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||
| 319 | 0 | my $response = $self->{ua}->request($req); | |||||||||||||||||||||||||||||||
| 320 | 0 | my $data = $self->_xml_response($response); | |||||||||||||||||||||||||||||||
| 321 | |||||||||||||||||||||||||||||||||
| 322 | 0 | my @ret = ( $response->message, $response->code, $data ); | |||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||
| 324 | 0 | ▶ | return wantarray ? @ret : \@ret; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 325 | } | ||||||||||||||||||||||||||||||||
| 326 | |||||||||||||||||||||||||||||||||
| 327 | =head2 put($url,$type,$content) | ||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||
| 329 | Performs a PUT action on the given URL, and returns the parsed XML response. | ||||||||||||||||||||||||||||||||
| 330 | |||||||||||||||||||||||||||||||||
| 331 | The optional value for $type is set as the Content Type for the transaction. | ||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||
| 333 | The optional value for $content is used as the content of the post. | ||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||
| 335 | =cut | ||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | sub put { | ||||||||||||||||||||||||||||||
|
Subroutine
put: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 338 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 339 | 0 | my $href = shift @_; | |||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||
| 341 | 0 | my $type = shift @_; | |||||||||||||||||||||||||||||||
| 342 | 0 | my $content = shift @_; | |||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||
| 344 | 0 | ▶ | $self->_debug("API: post($href)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 345 | 0 | my $req = HTTP::Request->new( PUT => $href ); | |||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||
| 347 | 0 | ▶ | $req->content($content) if $content; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 348 | 0 | ▶ | $req->content_type($type) if $type; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 349 | 0 | $req->header( Accept => $self->{learned}->{accept_header} ); | |||||||||||||||||||||||||||||||
| 350 | |||||||||||||||||||||||||||||||||
| 351 | 0 | $self->_debug_with_level(3,"Posting with XML Content-Type: $type","Posting XML content:\n\n$content\n\n"); | |||||||||||||||||||||||||||||||
| 352 | |||||||||||||||||||||||||||||||||
| 353 | 0 | my $response = $self->{ua}->request($req); | |||||||||||||||||||||||||||||||
| 354 | 0 | my $data = $self->_xml_response($response); | |||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||
| 356 | 0 | my @ret = ( $response->message, $response->code, $data ); | |||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||
| 358 | 0 | ▶ | return wantarray ? @ret : \@ret; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 359 | } | ||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||
| 361 | =head1 API SHORTHAND METHODS | ||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||
| 363 | =head2 api_version | ||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||
| 365 | * Relative URL: /api/versions | ||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||
| 367 | This call queries the server for the current version of the API supported. | ||||||||||||||||||||||||||||||||
| 368 | It is implicitly called when library is instanced. | ||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||
| 370 | =cut | ||||||||||||||||||||||||||||||||
| 371 | |||||||||||||||||||||||||||||||||
| 372 | 0 | ▶ | sub api_version { | ||||||||||||||||||||||||||||||
|
Subroutine
api_version: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 373 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 374 | 0 | my $url = URI->new('https://'. $self->{hostname} .'/api/versions'); # Check API version first! | |||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||
| 376 | 0 | $self->_debug("Checking $url for supported API versions"); | |||||||||||||||||||||||||||||||
| 377 | |||||||||||||||||||||||||||||||||
| 378 | 0 | my $req = HTTP::Request->new( GET => $url ); | |||||||||||||||||||||||||||||||
| 379 | 0 | my $response = $self->{ua}->request($req); | |||||||||||||||||||||||||||||||
| 380 | 0 | ▶ | if ( $response->status_line eq '200 OK' ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 381 | 0 | my $info = XMLin( $response->content ); | |||||||||||||||||||||||||||||||
| 382 | |||||||||||||||||||||||||||||||||
| 383 | #die Dumper($info); | ||||||||||||||||||||||||||||||||
| 384 | |||||||||||||||||||||||||||||||||
| 385 | 0 | $self->{learned}->{version} = 0; | |||||||||||||||||||||||||||||||
| 386 | 0 | for my $verblock ( @{$info->{VersionInfo}} ) { | |||||||||||||||||||||||||||||||
| 387 | 0 | ▶ | if ( $verblock->{Version} > $self->{learned}->{version} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 388 | 0 | $self->{raw}->{version} = $verblock; | |||||||||||||||||||||||||||||||
| 389 | 0 | $self->{learned}->{version} = $verblock->{Version}; | |||||||||||||||||||||||||||||||
| 390 | 0 | $self->{learned}->{url}->{login} = $verblock->{LoginUrl}; | |||||||||||||||||||||||||||||||
| 391 | } | ||||||||||||||||||||||||||||||||
| 392 | } | ||||||||||||||||||||||||||||||||
| 393 | |||||||||||||||||||||||||||||||||
| 394 | 0 | return $self->{learned}->{version}; | |||||||||||||||||||||||||||||||
| 395 | } else { | ||||||||||||||||||||||||||||||||
| 396 | 0 | $self->_fault($response); | |||||||||||||||||||||||||||||||
| 397 | } | ||||||||||||||||||||||||||||||||
| 398 | } | ||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||
| 400 | =head2 login | ||||||||||||||||||||||||||||||||
| 401 | |||||||||||||||||||||||||||||||||
| 402 | * Relative URL: dynamic, but usually: /login/ | ||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||
| 404 | This call takes the username and password provided in the config() and creates | ||||||||||||||||||||||||||||||||
| 405 | an authentication token from the server. If successful, it returns the login | ||||||||||||||||||||||||||||||||
| 406 | data returned by the server. | ||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||
| 408 | In the 5.1 version of the API, this is a list of several access URLs. | ||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||
| 410 | =cut | ||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||
| 412 | 0 | ▶ | sub login { | ||||||||||||||||||||||||||||||
|
Subroutine
login: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 413 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||
| 415 | 0 | $self->_debug('Login URL: '.$self->{learned}->{url}->{login}); | |||||||||||||||||||||||||||||||
| 416 | 0 | my $req = HTTP::Request->new( POST => $self->{learned}->{url}->{login} ); | |||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||
| 418 | 0 | $req->authorization_basic( $self->{username} .'@'. $self->{orgname}, $self->{password} ); | |||||||||||||||||||||||||||||||
| 419 | 0 | $self->_debug("Attempting to login: " . $self->{username} .'@'. $self->{orgname} .' '. $self->{password} ); | |||||||||||||||||||||||||||||||
| 420 | |||||||||||||||||||||||||||||||||
| 421 | 0 | $self->{learned}->{accept_header} = 'application/*+xml;version='.$self->{learned}->{version}; | |||||||||||||||||||||||||||||||
| 422 | 0 | $self->_debug('Accept header: '.$self->{learned}->{accept_header}); | |||||||||||||||||||||||||||||||
| 423 | 0 | $req->header( Accept => $self->{learned}->{accept_header} ); | |||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||
| 425 | 0 | my $response = $self->{ua}->request($req); | |||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||
| 427 | 0 | my $token = $response->header('x-vcloud-authorization'); | |||||||||||||||||||||||||||||||
| 428 | 0 | $self->{ua}->default_header('x-vcloud-authorization', $token); | |||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||
| 430 | 0 | $self->_debug( "Authentication status: " . $response->status_line ); | |||||||||||||||||||||||||||||||
| 431 | 0 | ▶ | if ( $response->status_line =~ /^4\d\d/ ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 432 | 0 | die "ERROR: Login Error: " . $response->status_line; | |||||||||||||||||||||||||||||||
| 433 | } | ||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||
| 435 | 0 | $self->_debug( "Authentication token: " . $token ); | |||||||||||||||||||||||||||||||
| 436 | |||||||||||||||||||||||||||||||||
| 437 | 0 | $self->{raw}->{login} = $self->_xml_response($response); | |||||||||||||||||||||||||||||||
| 438 | |||||||||||||||||||||||||||||||||
| 439 | 0 | for my $link ( @{$self->{raw}->{login}->{Link}} ) { | |||||||||||||||||||||||||||||||
| 440 | next | ||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | unless defined $link->{type}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||
| 443 | 0 | ▶ | $self->{learned}->{url}->{admin} = $link->{href} if $link->{type} eq 'application/vnd.vmware.admin.vcloud+xml'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 444 | 0 | ▶ | $self->{learned}->{url}->{entity} = $link->{href} if $link->{type} eq 'application/vnd.vmware.vcloud.entity+xml'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | $self->{learned}->{url}->{extensibility} = $link->{href} if $link->{type} eq 'application/vnd.vmware.vcloud.apiextensibility+xml'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | $self->{learned}->{url}->{extension} = $link->{href} if $link->{type} eq 'application/vnd.vmware.admin.vmwExtension+xml'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 447 | 0 | ▶ | $self->{learned}->{url}->{orglist} = $link->{href} if $link->{type} eq 'application/vnd.vmware.vcloud.orgList+xml'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 448 | 0 | ▶ | $self->{learned}->{url}->{query} = $link->{href} if $link->{type} eq 'application/vnd.vmware.vcloud.query.queryList+xml'; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 449 | #die Dumper($self->{raw}->{login}->{Link}); | ||||||||||||||||||||||||||||||||
| 450 | } | ||||||||||||||||||||||||||||||||
| 451 | |||||||||||||||||||||||||||||||||
| 452 | 0 | $self->{have_session} = 1; | |||||||||||||||||||||||||||||||
| 453 | 0 | return $self->{raw}->{login}; | |||||||||||||||||||||||||||||||
| 454 | } | ||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||
| 456 | =head2 logout() | ||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||
| 458 | Removes the current login session on the server. | ||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||
| 460 | =cut | ||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||
| 462 | # http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.doc_51/GUID-FBAA5B7D-8599-40C2-8081-E6D77DF18D5F.html | ||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||
| 464 | 0 | ▶ | sub logout { | ||||||||||||||||||||||||||||||
|
Subroutine
logout: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 465 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | $self->_debug("API: logout()\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 467 | 0 | $self->{have_session} = 0; | |||||||||||||||||||||||||||||||
| 468 | |||||||||||||||||||||||||||||||||
| 469 | 0 | my $url = $self->{learned}->{url}->{login}; | |||||||||||||||||||||||||||||||
| 470 | 0 | $url =~ s/sessions/session/; | |||||||||||||||||||||||||||||||
| 471 | 0 | my $req = HTTP::Request->new( DELETE => $self->{learned}->{url}->{login} ); | |||||||||||||||||||||||||||||||
| 472 | 0 | $req->header( Accept => $self->{learned}->{accept_header} ); | |||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||
| 474 | 0 | my $response = $self->{ua}->request($req); | |||||||||||||||||||||||||||||||
| 475 | 0 | ▶ | return 1 if $response->code() == 401; # No content is a successful logout | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 476 | 0 | return $self->_xml_response($response); | |||||||||||||||||||||||||||||||
| 477 | } | ||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||
| 479 | ### API methods | ||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||
| 481 | =head2 admin() | ||||||||||||||||||||||||||||||||
| 482 | |||||||||||||||||||||||||||||||||
| 483 | * Relative URL: dynamic admin URL, usually /api/admin/ | ||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||
| 485 | Parses the admin API URL to build and return a hash reference of key URLs for | ||||||||||||||||||||||||||||||||
| 486 | the API. | ||||||||||||||||||||||||||||||||
| 487 | |||||||||||||||||||||||||||||||||
| 488 | =cut | ||||||||||||||||||||||||||||||||
| 489 | |||||||||||||||||||||||||||||||||
| 490 | 0 | ▶ | sub admin { | ||||||||||||||||||||||||||||||
|
Subroutine
admin: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 491 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 492 | 0 | ▶ | $self->_debug("API: admin()\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 493 | 0 | ▶ | return $self->{learned}->{admin} if defined $self->{learned}->{admin}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||
| 495 | 0 | my $parsed = $self->get($self->{learned}->{url}->{admin}); | |||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||
| 497 | 0 | $self->{learned}->{admin}->{networks} = $parsed->{Networks}->[0]->{Network}; | |||||||||||||||||||||||||||||||
| 498 | 0 | $self->{learned}->{admin}->{rights} = $parsed->{RightReferences}->[0]->{RightReference}; | |||||||||||||||||||||||||||||||
| 499 | 0 | $self->{learned}->{admin}->{roles} = $parsed->{RoleReferences}->[0]->{RoleReference}; | |||||||||||||||||||||||||||||||
| 500 | 0 | $self->{learned}->{admin}->{orgs} = $parsed->{OrganizationReferences}->[0]->{OrganizationReference}; | |||||||||||||||||||||||||||||||
| 501 | 0 | $self->{learned}->{admin}->{pvdcs} = $parsed->{ProviderVdcReferences}->[0]->{ProviderVdcReference}; | |||||||||||||||||||||||||||||||
| 502 | |||||||||||||||||||||||||||||||||
| 503 | 0 | return $self->{learned}->{admin}; | |||||||||||||||||||||||||||||||
| 504 | } | ||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||
| 506 | =head2 admin_extension_get() | ||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||
| 508 | * Relative URL: dynamic admin URL followed by "/extension" | ||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||
| 510 | =cut | ||||||||||||||||||||||||||||||||
| 511 | |||||||||||||||||||||||||||||||||
| 512 | 0 | ▶ | sub admin_extension_get { | ||||||||||||||||||||||||||||||
|
Subroutine
admin_extension_get: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 513 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 514 | 0 | ▶ | $self->_debug("API: admin_extension_get()\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 515 | 0 | return $self->get( $self->{learned}->{url}->{admin} . 'extension' ); | |||||||||||||||||||||||||||||||
| 516 | } | ||||||||||||||||||||||||||||||||
| 517 | |||||||||||||||||||||||||||||||||
| 518 | =head2 admin_extension_vimServer_get() | ||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||
| 520 | =cut | ||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||
| 522 | 0 | ▶ | sub admin_extension_vimServer_get { | ||||||||||||||||||||||||||||||
|
Subroutine
admin_extension_vimServer_get: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 523 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 524 | 0 | my $url = shift @_; | |||||||||||||||||||||||||||||||
| 525 | 0 | ▶ | $self->_debug("API: admin_extension_vimServer_get($url)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 526 | 0 | return $self->get($url); | |||||||||||||||||||||||||||||||
| 527 | } | ||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||
| 529 | |||||||||||||||||||||||||||||||||
| 530 | =head2 admin_extension_vimServerReferences_get() | ||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||
| 532 | =cut | ||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | sub admin_extension_vimServerReferences_get { | ||||||||||||||||||||||||||||||
|
Subroutine
admin_extension_vimServerReferences_get: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 535 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | $self->_debug("API: admin_extension_vimServerReferences_get()\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 537 | 0 | return $self->get( $self->{learned}->{url}->{admin} . 'extension/vimServerReferences' ); | |||||||||||||||||||||||||||||||
| 538 | } | ||||||||||||||||||||||||||||||||
| 539 | |||||||||||||||||||||||||||||||||
| 540 | =head2 catalog_create($org_href,$conf) | ||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||
| 542 | $conf is a hashref that can contain: | ||||||||||||||||||||||||||||||||
| 543 | |||||||||||||||||||||||||||||||||
| 544 | =over 4 | ||||||||||||||||||||||||||||||||
| 545 | |||||||||||||||||||||||||||||||||
| 546 | =item * name | ||||||||||||||||||||||||||||||||
| 547 | |||||||||||||||||||||||||||||||||
| 548 | =item * description | ||||||||||||||||||||||||||||||||
| 549 | |||||||||||||||||||||||||||||||||
| 550 | =item * is_published | ||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||
| 552 | =back | ||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||
| 554 | Org HREF example: http://example.vcd.server/api/admin/org/{id} | ||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||
| 556 | =cut | ||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||
| 558 | # http://pubs.vmware.com/vcd-51/index.jsp?topic=%2Fcom.vmware.vcloud.api.reference.doc_51%2Fdoc%2Foperations%2FPOST-CreateCatalog.html | ||||||||||||||||||||||||||||||||
| 559 | |||||||||||||||||||||||||||||||||
| 560 | # Add catalog item http://pubs.vmware.com/vcd-51/index.jsp?topic=%2Fcom.vmware.vcloud.api.reference.doc_51%2Fdoc%2Foperations%2FPOST-CreateCatalogItem.html | ||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||
| 562 | 0 | ▶ | sub catalog_create { | ||||||||||||||||||||||||||||||
|
Subroutine
catalog_create: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 563 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 564 | 0 | my $url = shift @_; | |||||||||||||||||||||||||||||||
| 565 | 0 | my $conf = shift @_; | |||||||||||||||||||||||||||||||
| 566 | |||||||||||||||||||||||||||||||||
| 567 | 0 | ▶ | $conf->{is_published} = 0 unless defined $conf->{is_published}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 568 | |||||||||||||||||||||||||||||||||
| 569 | 0 | ▶ | $url .= '/catalogs' unless $url =~ /\/catalogs$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | $self->_debug("API: catalog_create($url)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 571 | |||||||||||||||||||||||||||||||||
| 572 | my $xml = '<AdminCatalog xmlns="http://www.vmware.com/vcloud/v1.5" name="'.$conf->{name}.'"> | ||||||||||||||||||||||||||||||||
| 573 | <Description>'.$conf->{description}.'</Description> | ||||||||||||||||||||||||||||||||
| 574 | 0 | <IsPublished>'.$conf->{is_published}.'</IsPublished> | |||||||||||||||||||||||||||||||
| 575 | </AdminCatalog>'; | ||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||
| 577 | 0 | my $ret = $self->post($url,'application/vnd.vmware.admin.catalog+xml',$xml); | |||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||
| 579 | 0 | ▶ | return $ret->[2]->{href} if $ret->[1] == 201; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 580 | 0 | return $ret; | |||||||||||||||||||||||||||||||
| 581 | } | ||||||||||||||||||||||||||||||||
| 582 | |||||||||||||||||||||||||||||||||
| 583 | =head2 catalog_get($catid or $caturl) | ||||||||||||||||||||||||||||||||
| 584 | |||||||||||||||||||||||||||||||||
| 585 | As a parameter, this method thakes the raw numeric id of the catalog or the full URL detailed for the catalog from the login catalog. | ||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||
| 587 | It returns the requested catalog. | ||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||
| 589 | =cut | ||||||||||||||||||||||||||||||||
| 590 | |||||||||||||||||||||||||||||||||
| 591 | 0 | ▶ | sub catalog_get { | ||||||||||||||||||||||||||||||
|
Subroutine
catalog_get: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 592 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 593 | 0 | my $cat = shift @_; | |||||||||||||||||||||||||||||||
| 594 | 0 | ▶ | $self->_debug("API: catalog_get($cat)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 595 | 0 | ▶ | return $self->get( $cat =~ /^[^\/]+$/ ? $self->{url_base} . 'catalog/' . $cat : $cat ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 596 | } | ||||||||||||||||||||||||||||||||
| 597 | |||||||||||||||||||||||||||||||||
| 598 | =head2 catalog_get_access($cat_href,$org_href) | ||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||
| 600 | HREF example: http://example.vcd.server/api/org/{id}/catalog/{catalogId}/action/controlAccess | ||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||
| 602 | =cut | ||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||
| 604 | # http://pubs.vmware.com/vcd-51/index.jsp?topic=%2Fcom.vmware.vcloud.api.reference.doc_51%2Fdoc%2Ftypes%2FControlAccessParamsType.html | ||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||
| 606 | 0 | ▶ | sub catalog_get_access { | ||||||||||||||||||||||||||||||
|
Subroutine
catalog_get_access: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 607 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 608 | 0 | my $cat_href = shift @_; | |||||||||||||||||||||||||||||||
| 609 | 0 | my $org_href = shift @_; | |||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||
| 611 | 0 | ▶ | die 'Bad Catalog HREF' unless $cat_href =~ /(\/catalog\/[^\/]+)$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 612 | 0 | my $href = $org_href . $1 . '/controlAccess'; | |||||||||||||||||||||||||||||||
| 613 | 0 | $href =~ s/admin\///; | |||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||
| 615 | 0 | ▶ | $self->_debug("API: catalog_get_access($href)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 616 | 0 | return $self->get($href); | |||||||||||||||||||||||||||||||
| 617 | } | ||||||||||||||||||||||||||||||||
| 618 | |||||||||||||||||||||||||||||||||
| 619 | =head2 catalog_set_access($cat_href,$org_href,$is_shared,$level) | ||||||||||||||||||||||||||||||||
| 620 | |||||||||||||||||||||||||||||||||
| 621 | The sets the "organizational" sharing for a catalog. | ||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||
| 623 | =over 4 | ||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||
| 625 | =item * is_shared - 1 or 0 | ||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||
| 627 | =item * level - one of: FullControl, Change, ReadOnly | ||||||||||||||||||||||||||||||||
| 628 | |||||||||||||||||||||||||||||||||
| 629 | =back | ||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||
| 631 | HREF example: http://example.vcd.server/api/org/{id}/catalog/{catalogId}/action/controlAccess | ||||||||||||||||||||||||||||||||
| 632 | |||||||||||||||||||||||||||||||||
| 633 | =cut | ||||||||||||||||||||||||||||||||
| 634 | |||||||||||||||||||||||||||||||||
| 635 | # http://pubs.vmware.com/vcd-51/index.jsp?topic=%2Fcom.vmware.vcloud.api.reference.doc_51%2Fdoc%2Ftypes%2FControlAccessParamsType.html | ||||||||||||||||||||||||||||||||
| 636 | |||||||||||||||||||||||||||||||||
| 637 | 0 | ▶ | sub catalog_set_access { | ||||||||||||||||||||||||||||||
|
Subroutine
catalog_set_access: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 638 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 639 | 0 | my $cat_href = shift @_; | |||||||||||||||||||||||||||||||
| 640 | 0 | my $org_href = shift @_; | |||||||||||||||||||||||||||||||
| 641 | 0 | my $is_shared = shift @_; | |||||||||||||||||||||||||||||||
| 642 | 0 | my $level = shift @_; | |||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||
| 644 | 0 | ▶ | die 'Bad Catalog HREF' unless $cat_href =~ /(\/catalog\/[^\/]+)$/; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 645 | 0 | my $href = $org_href . $1 . '/action/controlAccess'; | |||||||||||||||||||||||||||||||
| 646 | 0 | $href =~ s/admin\///; | |||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||
| 648 | 0 | ▶ | $self->_debug("API: catalog_set_access($href)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 649 | |||||||||||||||||||||||||||||||||
| 650 | 0 | my $xml = '<ControlAccessParams xmlns="http://www.vmware.com/vcloud/v1.5"> | |||||||||||||||||||||||||||||||
| 651 | <IsSharedToEveryone>'.$is_shared.'</IsSharedToEveryone> | ||||||||||||||||||||||||||||||||
| 652 | <EveryoneAccessLevel>'.$level.'</EveryoneAccessLevel> | ||||||||||||||||||||||||||||||||
| 653 | </ControlAccessParams>'; | ||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||
| 655 | 0 | my $ret = $self->post($href,'application/vnd.vmware.vcloud.controlAccess+xml',$xml); | |||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||
| 657 | 0 | ▶ | return $ret->[2]->{href} if $ret->[1] == 201; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 658 | 0 | return $ret; | |||||||||||||||||||||||||||||||
| 659 | } | ||||||||||||||||||||||||||||||||
| 660 | |||||||||||||||||||||||||||||||||
| 661 | =head2 datastore_list() | ||||||||||||||||||||||||||||||||
| 662 | |||||||||||||||||||||||||||||||||
| 663 | Connect to the System group for this query to work. | ||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||
| 665 | Returns a hash(ref) or datastore information. | ||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||
| 667 | =cut | ||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||
| 669 | 0 | ▶ | sub datastore_list { | ||||||||||||||||||||||||||||||
|
Subroutine
datastore_list: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 670 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 671 | 0 | my $query_url = $self->{learned}->{url}->{query} . '?type=datastore&format=idrecords'; | |||||||||||||||||||||||||||||||
| 672 | 0 | return $self->get($query_url); | |||||||||||||||||||||||||||||||
| 673 | } | ||||||||||||||||||||||||||||||||
| 674 | |||||||||||||||||||||||||||||||||
| 675 | =head2 org_create($name,$desc,$fullname,$is_enabled) | ||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||
| 677 | Create an organization. | ||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||
| 679 | =over 4 | ||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||
| 681 | =item * name | ||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||
| 683 | =item * desc | ||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||
| 685 | =item * fullname | ||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||
| 687 | =item * is_enabled | ||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||
| 689 | =item * can_publish | ||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||
| 691 | =item * deployed | ||||||||||||||||||||||||||||||||
| 692 | |||||||||||||||||||||||||||||||||
| 693 | =item * stored | ||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||
| 695 | =item * ldap_mode: NONE, SYSTEM or CUSTOM - Custom requires further parameters not implemented yet. Default is NONE | ||||||||||||||||||||||||||||||||
| 696 | |||||||||||||||||||||||||||||||||
| 697 | =back | ||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||
| 699 | =cut | ||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||
| 701 | # http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.doc_51/GUID-439C57EA-859C-423C-B21B-22B230395600.html | ||||||||||||||||||||||||||||||||
| 702 | # http://www.vmware.com/support/vcd/doc/rest-api-doc-1.5-html/operations/PUT-Organization.html | ||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||
| 704 | 0 | ▶ | sub org_create { | ||||||||||||||||||||||||||||||
|
Subroutine
org_create: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 705 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 706 | 0 | my $conf = shift @_; | |||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||
| 708 | 0 | ▶ | $self->_debug("API: org_create()\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 709 | 0 | my $url = $self->{learned}->{url}->{admin} . 'orgs'; | |||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | $conf->{ldap_mode} = 'NONE' unless defined $conf->{ldap_mode}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 712 | |||||||||||||||||||||||||||||||||
| 713 | 0 | my $vapp_lease = '<VAppLeaseSettings> | |||||||||||||||||||||||||||||||
| 714 | <DeleteOnStorageLeaseExpiration>0</DeleteOnStorageLeaseExpiration> | ||||||||||||||||||||||||||||||||
| 715 | <DeploymentLeaseSeconds>0</DeploymentLeaseSeconds> | ||||||||||||||||||||||||||||||||
| 716 | <StorageLeaseSeconds>0</StorageLeaseSeconds> | ||||||||||||||||||||||||||||||||
| 717 | </VAppLeaseSettings>'; | ||||||||||||||||||||||||||||||||
| 718 | |||||||||||||||||||||||||||||||||
| 719 | 0 | my $tmpl_lease = '<VAppTemplateLeaseSettings> | |||||||||||||||||||||||||||||||
| 720 | <DeleteOnStorageLeaseExpiration>0</DeleteOnStorageLeaseExpiration> | ||||||||||||||||||||||||||||||||
| 721 | <StorageLeaseSeconds>0</StorageLeaseSeconds> | ||||||||||||||||||||||||||||||||
| 722 | </VAppTemplateLeaseSettings>'; | ||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||
| 724 | 0 | my $vdcs; | |||||||||||||||||||||||||||||||
| 725 | 0 | ▶ | if ( defined $conf->{vdc} and ref $conf->{vdc} ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined $conf->{"vdc"} and ref $conf->{"vdc"}
MC/DC0%0/2
defined $conf->{"vdc"} and ref $conf->{"vdc"}
defined $conf->{"vdc"}
ref $conf->{"vdc"}
Truth table0%0/3
A and B
A= defined $conf->{"vdc"}B= ref $conf->{"vdc"}
| |||||||||||||||||||||||||||||||||
| 726 | 0 | for my $vdc (@{$conf->{vdc}}) { | |||||||||||||||||||||||||||||||
| 727 | 0 | $vdcs .= '<Vdc href="'.$vdc.'"/> '; | |||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||
| 729 | } elsif ( defined $conf->{vdc} ) { | ||||||||||||||||||||||||||||||||
| 730 | 0 | $vdcs = '<Vdc href="'.$conf->{vdc}.'"/> '; | |||||||||||||||||||||||||||||||
| 731 | } | ||||||||||||||||||||||||||||||||
| 732 | 0 | $vdcs .= "\n"; | |||||||||||||||||||||||||||||||
| 733 | |||||||||||||||||||||||||||||||||
| 734 | my $xml = ' | ||||||||||||||||||||||||||||||||
| 735 | <AdminOrg xmlns="http://www.vmware.com/vcloud/v1.5" name="'.$conf->{name}.'"> | ||||||||||||||||||||||||||||||||
| 736 | <Description>'.$conf->{desc}.'</Description> | ||||||||||||||||||||||||||||||||
| 737 | <FullName>'.$conf->{fullname}.'</FullName> | ||||||||||||||||||||||||||||||||
| 738 | <IsEnabled>'.$conf->{is_enabled}.'</IsEnabled> | ||||||||||||||||||||||||||||||||
| 739 | <Settings> | ||||||||||||||||||||||||||||||||
| 740 | <OrgGeneralSettings> | ||||||||||||||||||||||||||||||||
| 741 | <CanPublishCatalogs>'.$conf->{can_publish}.'</CanPublishCatalogs> | ||||||||||||||||||||||||||||||||
| 742 | <DeployedVMQuota>'.$conf->{deployed}.'</DeployedVMQuota> | ||||||||||||||||||||||||||||||||
| 743 | <StoredVmQuota>'.$conf->{stored}.'</StoredVmQuota> | ||||||||||||||||||||||||||||||||
| 744 | <UseServerBootSequence>false</UseServerBootSequence> | ||||||||||||||||||||||||||||||||
| 745 | <DelayAfterPowerOnSeconds>1</DelayAfterPowerOnSeconds> | ||||||||||||||||||||||||||||||||
| 746 | </OrgGeneralSettings> | ||||||||||||||||||||||||||||||||
| 747 | '.$vapp_lease.' | ||||||||||||||||||||||||||||||||
| 748 | '.$tmpl_lease.' | ||||||||||||||||||||||||||||||||
| 749 | <OrgLdapSettings> | ||||||||||||||||||||||||||||||||
| 750 | 0 | <OrgLdapMode>'.$conf->{ldap_mode}.'</OrgLdapMode> | |||||||||||||||||||||||||||||||
| 751 | </OrgLdapSettings> | ||||||||||||||||||||||||||||||||
| 752 | </Settings> | ||||||||||||||||||||||||||||||||
| 753 | <Vdcs> | ||||||||||||||||||||||||||||||||
| 754 | '.$vdcs.' | ||||||||||||||||||||||||||||||||
| 755 | </Vdcs> | ||||||||||||||||||||||||||||||||
| 756 | </AdminOrg> | ||||||||||||||||||||||||||||||||
| 757 | '; | ||||||||||||||||||||||||||||||||
| 758 | |||||||||||||||||||||||||||||||||
| 759 | 0 | my $ret = $self->post($url,'application/vnd.vmware.admin.organization+xml',$xml); | |||||||||||||||||||||||||||||||
| 760 | |||||||||||||||||||||||||||||||||
| 761 | 0 | ▶ | return $ret->[2]->{href} if $ret->[1] == 201; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 762 | 0 | return $ret; | |||||||||||||||||||||||||||||||
| 763 | } | ||||||||||||||||||||||||||||||||
| 764 | |||||||||||||||||||||||||||||||||
| 765 | =head2 org_get($orgid or $orgurl) | ||||||||||||||||||||||||||||||||
| 766 | |||||||||||||||||||||||||||||||||
| 767 | As a parameter, this method takes the raw numeric id of the organization or the full URL detailed for the organization from the login catalog. | ||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||
| 769 | It returns the requested organization. | ||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||
| 771 | =cut | ||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | sub org_get { | ||||||||||||||||||||||||||||||
|
Subroutine
org_get: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 774 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 775 | 0 | my $org = shift @_; | |||||||||||||||||||||||||||||||
| 776 | 0 | my $req; | |||||||||||||||||||||||||||||||
| 777 | |||||||||||||||||||||||||||||||||
| 778 | 0 | ▶ | $self->_debug("API: org_get($org)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 779 | 0 | ▶ | return $self->get( $org =~ /^[^\/]+$/ ? $self->{url_base} . 'org/' . $org : $org ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 780 | } | ||||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||
| 782 | =head2 org_list() | ||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||
| 784 | Returns the full list of available organizations. | ||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||
| 786 | =cut | ||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||
| 788 | 0 | ▶ | sub org_list { | ||||||||||||||||||||||||||||||
|
Subroutine
org_list: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 789 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 790 | 0 | ▶ | $self->_debug("API: org_list()\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 791 | 0 | return $self->get($self->{learned}->{url}->{orglist}); | |||||||||||||||||||||||||||||||
| 792 | } | ||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||
| 794 | =head2 org_network_create($url,$conf) | ||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||
| 796 | Create an org network | ||||||||||||||||||||||||||||||||
| 797 | |||||||||||||||||||||||||||||||||
| 798 | The conf hash reference can contain: | ||||||||||||||||||||||||||||||||
| 799 | |||||||||||||||||||||||||||||||||
| 800 | =over 4 | ||||||||||||||||||||||||||||||||
| 801 | |||||||||||||||||||||||||||||||||
| 802 | =item * name | ||||||||||||||||||||||||||||||||
| 803 | |||||||||||||||||||||||||||||||||
| 804 | =item * desc | ||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||
| 806 | =item * gateway | ||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||
| 808 | =item * netmask | ||||||||||||||||||||||||||||||||
| 809 | |||||||||||||||||||||||||||||||||
| 810 | =item * dns1 | ||||||||||||||||||||||||||||||||
| 811 | |||||||||||||||||||||||||||||||||
| 812 | =item * dns2 | ||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||
| 814 | =item * dnssuffix | ||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||
| 816 | =item * is_enabled | ||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||
| 818 | =item * is_shared | ||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||
| 820 | =item * start_ip | ||||||||||||||||||||||||||||||||
| 821 | |||||||||||||||||||||||||||||||||
| 822 | =item * end_ip | ||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||
| 824 | =back | ||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||
| 826 | =cut | ||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||
| 828 | 0 | ▶ | sub org_network_create { | ||||||||||||||||||||||||||||||
|
Subroutine
org_network_create: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||
| 829 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 830 | 0 | my $url = shift @_; | |||||||||||||||||||||||||||||||
| 831 | 0 | my $conf = shift @_; | |||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||
| 833 | 0 | ▶ | $conf->{is_shared} = 0 unless defined $conf->{is_shared}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||
| 835 | 0 | ▶ | $self->_debug("API: org_network_create()\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||
| 837 | # my $xml = ' | ||||||||||||||||||||||||||||||||
| 838 | #<OrgNetwork xmlns="http://www.vmware.com/vcloud/v1.5" name="'.$name.'"> | ||||||||||||||||||||||||||||||||
| 839 | # <Description>'.$desc.'</Description> | ||||||||||||||||||||||||||||||||
| 840 | # <Configuration> | ||||||||||||||||||||||||||||||||
| 841 | # <IpScopes> | ||||||||||||||||||||||||||||||||
| 842 | # <IpScope> | ||||||||||||||||||||||||||||||||
| 843 | # <IsInherited>false</IsInherited> | ||||||||||||||||||||||||||||||||
| 844 | # <Gateway>'.$gateway .'</Gateway> | ||||||||||||||||||||||||||||||||
| 845 | # <Netmask>'.$netmask.'</Netmask> | ||||||||||||||||||||||||||||||||
| 846 | # <Dns1>'.$dns1.'</Dns1> | ||||||||||||||||||||||||||||||||
| 847 | # <Dns2>'.$dns2.'</Dns2> | ||||||||||||||||||||||||||||||||
| 848 | # <DnsSuffix>'.$dnssuffix.'</DnsSuffix> | ||||||||||||||||||||||||||||||||
| 849 | # <IpRanges> | ||||||||||||||||||||||||||||||||
| 850 | # <IpRange> | ||||||||||||||||||||||||||||||||
| 851 | # <StartAddress>'.$start_ip.'</StartAddress> | ||||||||||||||||||||||||||||||||
| 852 | # <EndAddress>'.$end_ip.'</EndAddress> | ||||||||||||||||||||||||||||||||
| 853 | # </IpRange> | ||||||||||||||||||||||||||||||||
| 854 | # </IpRanges> | ||||||||||||||||||||||||||||||||
| 855 | # </IpScope> | ||||||||||||||||||||||||||||||||
| 856 | # </IpScopes> | ||||||||||||||||||||||||||||||||
| 857 | # <FenceMode>natRouted</FenceMode> | ||||||||||||||||||||||||||||||||
| 858 | # </Configuration> | ||||||||||||||||||||||||||||||||
| 859 | # <EdgeGateway | ||||||||||||||||||||||||||||||||
| 860 | # href="https://vcloud.example.com/api/admin/gateway/2000" /> | ||||||||||||||||||||||||||||||||
| 861 | # <IsShared>true</IsShared> | ||||||||||||||||||||||||||||||||
| 862 | #</OrgVdcNetwork> | ||||||||||||||||||||||||||||||||
| 863 | # '; | ||||||||||||||||||||||||||||||||
| 864 | |||||||||||||||||||||||||||||||||
| 865 | my $xml = '<OrgVdcNetwork | ||||||||||||||||||||||||||||||||
| 866 | name="'.$conf->{name}.'" | ||||||||||||||||||||||||||||||||
| 867 | xmlns="http://www.vmware.com/vcloud/v1.5"> | ||||||||||||||||||||||||||||||||
| 868 | <Description>'.$conf->{desc}.'</Description> | ||||||||||||||||||||||||||||||||
| 869 | <Configuration> | ||||||||||||||||||||||||||||||||
| 870 | <ParentNetwork | ||||||||||||||||||||||||||||||||
| 871 | href="'.$conf->{parent_net_href}.'" /> | ||||||||||||||||||||||||||||||||
| 872 | <FenceMode>bridged</FenceMode> | ||||||||||||||||||||||||||||||||
| 873 | </Configuration> | ||||||||||||||||||||||||||||||||
| 874 | 0 | <IsShared>'.$conf->{is_shared}.'</IsShared> | |||||||||||||||||||||||||||||||
| 875 | </OrgVdcNetwork>'; | ||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||
| 877 | 0 | $url .= '/networks'; | |||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||
| 879 | 0 | my $ret = $self->post($url,'application/vnd.vmware.vcloud.orgVdcNetwork+xml',$xml); | |||||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||||
| 881 | 0 | ▶ | return $ret->[2]->{href} if $ret->[1] == 201; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 882 | 0 | return $ret; | |||||||||||||||||||||||||||||||
| 883 | } | ||||||||||||||||||||||||||||||||
| 884 | |||||||||||||||||||||||||||||||||
| 885 | =head2 org_vdc_create($url,$conf) | ||||||||||||||||||||||||||||||||
| 886 | |||||||||||||||||||||||||||||||||
| 887 | Create an org VDC | ||||||||||||||||||||||||||||||||
| 888 | |||||||||||||||||||||||||||||||||
| 889 | The conf hash reference can contain: | ||||||||||||||||||||||||||||||||
| 890 | |||||||||||||||||||||||||||||||||
| 891 | =over 4 | ||||||||||||||||||||||||||||||||
| 892 | |||||||||||||||||||||||||||||||||
| 893 | =item * name | ||||||||||||||||||||||||||||||||
| 894 | |||||||||||||||||||||||||||||||||
| 895 | =item * desc | ||||||||||||||||||||||||||||||||
| 896 | |||||||||||||||||||||||||||||||||
| 897 | =item * np_href | ||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||
| 899 | =item * sp_enabled | ||||||||||||||||||||||||||||||||
| 900 | |||||||||||||||||||||||||||||||||
| 901 | =item * sp_units | ||||||||||||||||||||||||||||||||
| 902 | |||||||||||||||||||||||||||||||||
| 903 | =item * sp_limit | ||||||||||||||||||||||||||||||||
| 904 | |||||||||||||||||||||||||||||||||
| 905 | =item * sp_default | ||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||
| 907 | =item * sp_href | ||||||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||||||
| 909 | =item * allocation_model | ||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||
| 911 | =item * cpu_unit | ||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||
| 913 | =item * cpu_alloc | ||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||
| 915 | =item * cpu_limit | ||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||
| 917 | =item * mem_unit | ||||||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||||||
| 919 | =item * mem_alloc | ||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||
| 921 | =item * mem_limit | ||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||
| 923 | =item * nic_quota | ||||||||||||||||||||||||||||||||
| 924 | |||||||||||||||||||||||||||||||||
| 925 | =item * net_quota | ||||||||||||||||||||||||||||||||
| 926 | |||||||||||||||||||||||||||||||||
| 927 | =item * ResourceGuaranteedMemory | ||||||||||||||||||||||||||||||||
| 928 | |||||||||||||||||||||||||||||||||
| 929 | =item * ResourceGuaranteedCpu | ||||||||||||||||||||||||||||||||
| 930 | |||||||||||||||||||||||||||||||||
| 931 | =item * VCpuInMhz | ||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||
| 933 | =item * is_thin_provision | ||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||
| 935 | =item * pvdc_name | ||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||
| 937 | =item * pvdc_href | ||||||||||||||||||||||||||||||||
| 938 | |||||||||||||||||||||||||||||||||
| 939 | =item * use_fast_provisioning | ||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||
| 941 | =back | ||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||
| 943 | =cut | ||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||
| 945 | # http://pubs.vmware.com/vcd-51/index.jsp?topic=%2Fcom.vmware.vcloud.api.reference.doc_51%2Fdoc%2Ftypes%2FCreateVdcParamsType.html | ||||||||||||||||||||||||||||||||
| 946 | |||||||||||||||||||||||||||||||||
| 947 | 0 | ▶ | sub org_vdc_create { | ||||||||||||||||||||||||||||||
|
Subroutine
org_vdc_create: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 948 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 949 | 0 | my $url = shift @_; | |||||||||||||||||||||||||||||||
| 950 | 0 | my $conf = shift @_; | |||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||
| 952 | 0 | ▶ | $self->_debug("API: org_vdc_create()\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||
| 954 | 0 | ▶ | my $networkpool = $conf->{np_href} ? '<NetworkPoolReference href="'.$conf->{np_href}.'"/>' : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||
| 956 | 0 | my $sp; | |||||||||||||||||||||||||||||||
| 957 | 0 | ▶ | if ( defined $conf->{sp} and ref $conf->{sp} ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined $conf->{"sp"} and ref $conf->{"sp"}
MC/DC0%0/2
defined $conf->{"sp"} and ref $conf->{"sp"}
defined $conf->{"sp"}
ref $conf->{"sp"}
Truth table0%0/3
A and B
A= defined $conf->{"sp"}B= ref $conf->{"sp"}
| |||||||||||||||||||||||||||||||||
| 958 | 0 | for my $ref ( @{$conf->{sp}} ) { | |||||||||||||||||||||||||||||||
| 959 | $sp .= '<VdcStorageProfile> | ||||||||||||||||||||||||||||||||
| 960 | <Enabled>'.$ref->{sp_enabled}.'</Enabled> | ||||||||||||||||||||||||||||||||
| 961 | <Units>'.$ref->{sp_units}.'</Units> | ||||||||||||||||||||||||||||||||
| 962 | <Limit>'.$ref->{sp_limit}.'</Limit> | ||||||||||||||||||||||||||||||||
| 963 | <Default>'.$ref->{sp_default}.'</Default> | ||||||||||||||||||||||||||||||||
| 964 | 0 | <ProviderVdcStorageProfile href="'.$ref->{sp_href}.'" /> | |||||||||||||||||||||||||||||||
| 965 | </VdcStorageProfile>'; | ||||||||||||||||||||||||||||||||
| 966 | } | ||||||||||||||||||||||||||||||||
| 967 | } elsif ( defined $conf->{sp_enabled} ) { | ||||||||||||||||||||||||||||||||
| 968 | $sp = '<VdcStorageProfile> | ||||||||||||||||||||||||||||||||
| 969 | <Enabled>'.$conf->{sp_enabled}.'</Enabled> | ||||||||||||||||||||||||||||||||
| 970 | <Units>'.$conf->{sp_units}.'</Units> | ||||||||||||||||||||||||||||||||
| 971 | <Limit>'.$conf->{sp_limit}.'</Limit> | ||||||||||||||||||||||||||||||||
| 972 | <Default>'.$conf->{sp_default}.'</Default> | ||||||||||||||||||||||||||||||||
| 973 | 0 | <ProviderVdcStorageProfile href="'.$conf->{sp_href}.'" /> | |||||||||||||||||||||||||||||||
| 974 | </VdcStorageProfile>'; | ||||||||||||||||||||||||||||||||
| 975 | } | ||||||||||||||||||||||||||||||||
| 976 | |||||||||||||||||||||||||||||||||
| 977 | my $xml = ' | ||||||||||||||||||||||||||||||||
| 978 | <CreateVdcParams xmlns="http://www.vmware.com/vcloud/v1.5" name="'.$conf->{name}.'"> | ||||||||||||||||||||||||||||||||
| 979 | <Description>'.$conf->{desc}.'</Description> | ||||||||||||||||||||||||||||||||
| 980 | <AllocationModel>'.$conf->{allocation_model}.'</AllocationModel> | ||||||||||||||||||||||||||||||||
| 981 | <ComputeCapacity> | ||||||||||||||||||||||||||||||||
| 982 | <Cpu> | ||||||||||||||||||||||||||||||||
| 983 | <Units>'.$conf->{cpu_unit}.'</Units> | ||||||||||||||||||||||||||||||||
| 984 | <Allocated>'.$conf->{cpu_alloc}.'</Allocated> | ||||||||||||||||||||||||||||||||
| 985 | <Limit>'.$conf->{cpu_limit}.'</Limit> | ||||||||||||||||||||||||||||||||
| 986 | </Cpu> | ||||||||||||||||||||||||||||||||
| 987 | <Memory> | ||||||||||||||||||||||||||||||||
| 988 | <Units>'.$conf->{mem_unit}.'</Units> | ||||||||||||||||||||||||||||||||
| 989 | <Allocated>'.$conf->{mem_alloc}.'</Allocated> | ||||||||||||||||||||||||||||||||
| 990 | <Limit>'.$conf->{mem_limit}.'</Limit> | ||||||||||||||||||||||||||||||||
| 991 | </Memory> | ||||||||||||||||||||||||||||||||
| 992 | </ComputeCapacity> | ||||||||||||||||||||||||||||||||
| 993 | <NicQuota>'.$conf->{nic_quota}.'</NicQuota> | ||||||||||||||||||||||||||||||||
| 994 | <NetworkQuota>'.$conf->{net_quota}.'</NetworkQuota> | ||||||||||||||||||||||||||||||||
| 995 | '.$sp.' | ||||||||||||||||||||||||||||||||
| 996 | <ResourceGuaranteedMemory>'.$conf->{ResourceGuaranteedMemory}.'</ResourceGuaranteedMemory> | ||||||||||||||||||||||||||||||||
| 997 | <ResourceGuaranteedCpu>'.$conf->{ResourceGuaranteedCpu}.'</ResourceGuaranteedCpu> | ||||||||||||||||||||||||||||||||
| 998 | <VCpuInMhz>'.$conf->{VCpuInMhz}.'</VCpuInMhz> | ||||||||||||||||||||||||||||||||
| 999 | <IsThinProvision>'.$conf->{is_thin_provision}.'</IsThinProvision> | ||||||||||||||||||||||||||||||||
| 1000 | '.$networkpool.' | ||||||||||||||||||||||||||||||||
| 1001 | <ProviderVdcReference | ||||||||||||||||||||||||||||||||
| 1002 | name="'.$conf->{pvdc_name}.'" | ||||||||||||||||||||||||||||||||
| 1003 | href="'.$conf->{pvdc_href}.'" /> | ||||||||||||||||||||||||||||||||
| 1004 | 0 | <UsesFastProvisioning>'.$conf->{use_fast_provisioning}.'</UsesFastProvisioning> | |||||||||||||||||||||||||||||||
| 1005 | </CreateVdcParams> | ||||||||||||||||||||||||||||||||
| 1006 | '; | ||||||||||||||||||||||||||||||||
| 1007 | |||||||||||||||||||||||||||||||||
| 1008 | 0 | $url .= '/vdcsparams'; | |||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||
| 1010 | 0 | my $ret = $self->post($url,'application/vnd.vmware.admin.createVdcParams+xml',$xml); | |||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||
| 1012 | 0 | ▶ | return $ret->[2]->{href} if $ret->[1] == 201; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1013 | 0 | return $ret; | |||||||||||||||||||||||||||||||
| 1014 | } | ||||||||||||||||||||||||||||||||
| 1015 | |||||||||||||||||||||||||||||||||
| 1016 | =head2 org_vdc_update($url,$conf) | ||||||||||||||||||||||||||||||||
| 1017 | |||||||||||||||||||||||||||||||||
| 1018 | Create an org VDC | ||||||||||||||||||||||||||||||||
| 1019 | |||||||||||||||||||||||||||||||||
| 1020 | The conf hash reference can contain: | ||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||
| 1022 | =over 4 | ||||||||||||||||||||||||||||||||
| 1023 | |||||||||||||||||||||||||||||||||
| 1024 | =item * name (required) | ||||||||||||||||||||||||||||||||
| 1025 | |||||||||||||||||||||||||||||||||
| 1026 | =item * desc | ||||||||||||||||||||||||||||||||
| 1027 | |||||||||||||||||||||||||||||||||
| 1028 | =item * np_href | ||||||||||||||||||||||||||||||||
| 1029 | |||||||||||||||||||||||||||||||||
| 1030 | =item * sp_enabled | ||||||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||||||
| 1032 | =item * sp_units | ||||||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||||||
| 1034 | =item * sp_limit | ||||||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||||||
| 1036 | =item * sp_default | ||||||||||||||||||||||||||||||||
| 1037 | |||||||||||||||||||||||||||||||||
| 1038 | =item * sp_href | ||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||
| 1040 | =item * allocation_model | ||||||||||||||||||||||||||||||||
| 1041 | |||||||||||||||||||||||||||||||||
| 1042 | =item * cpu_unit | ||||||||||||||||||||||||||||||||
| 1043 | |||||||||||||||||||||||||||||||||
| 1044 | =item * cpu_alloc | ||||||||||||||||||||||||||||||||
| 1045 | |||||||||||||||||||||||||||||||||
| 1046 | =item * cpu_limit | ||||||||||||||||||||||||||||||||
| 1047 | |||||||||||||||||||||||||||||||||
| 1048 | =item * mem_unit | ||||||||||||||||||||||||||||||||
| 1049 | |||||||||||||||||||||||||||||||||
| 1050 | =item * mem_alloc | ||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||
| 1052 | =item * mem_limit | ||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||
| 1054 | =item * nic_quota | ||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||
| 1056 | =item * net_quota | ||||||||||||||||||||||||||||||||
| 1057 | |||||||||||||||||||||||||||||||||
| 1058 | =item * ResourceGuaranteedMemory | ||||||||||||||||||||||||||||||||
| 1059 | |||||||||||||||||||||||||||||||||
| 1060 | =item * ResourceGuaranteedCpu | ||||||||||||||||||||||||||||||||
| 1061 | |||||||||||||||||||||||||||||||||
| 1062 | =item * VCpuInMhz | ||||||||||||||||||||||||||||||||
| 1063 | |||||||||||||||||||||||||||||||||
| 1064 | =item * is_thin_provision | ||||||||||||||||||||||||||||||||
| 1065 | |||||||||||||||||||||||||||||||||
| 1066 | =item * pvdc_name | ||||||||||||||||||||||||||||||||
| 1067 | |||||||||||||||||||||||||||||||||
| 1068 | =item * pvdc_href | ||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||
| 1070 | =item * use_fast_provisioning | ||||||||||||||||||||||||||||||||
| 1071 | |||||||||||||||||||||||||||||||||
| 1072 | =back | ||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||
| 1074 | =cut | ||||||||||||||||||||||||||||||||
| 1075 | |||||||||||||||||||||||||||||||||
| 1076 | # http://pubs.vmware.com/vcd-51/index.jsp?topic=%2Fcom.vmware.vcloud.api.reference.doc_51%2Fdoc%2Ftypes%2FAdminVdcType.html | ||||||||||||||||||||||||||||||||
| 1077 | |||||||||||||||||||||||||||||||||
| 1078 | 0 | ▶ | sub org_vdc_update { | ||||||||||||||||||||||||||||||
|
Subroutine
org_vdc_update: not called CC=20 SCAR=60.4
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1079 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 1080 | 0 | my $url = shift @_; | |||||||||||||||||||||||||||||||
| 1081 | 0 | my $conf = shift @_; | |||||||||||||||||||||||||||||||
| 1082 | 0 | ▶ | $self->_debug("API: org_vdc_update()\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1083 | |||||||||||||||||||||||||||||||||
| 1084 | 0 | my $desc = '<Description>'.$conf->{desc}."</Description>\n"; | |||||||||||||||||||||||||||||||
| 1085 | 0 | ▶ | my $alloc = $conf->{allocation_model} ? '<AllocationModel>'.$conf->{allocation_model}."</AllocationModel>\n" : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1086 | 0 | my $compute; | |||||||||||||||||||||||||||||||
| 1087 | 0 | ▶ | my $nicquota = defined $conf->{nic_quota} ? '<NicQuota>'.$conf->{nic_quota}."</NicQuota>\n" : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1088 | 0 | ▶ | my $netquota = defined $conf->{net_quota} ? '<NetworkQuota>'.$conf->{net_quota}."</NetworkQuota>\n" : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1089 | 0 | my $sp; | |||||||||||||||||||||||||||||||
| 1090 | 0 | ▶ | my $networkpool = $conf->{np_href} ? '<NetworkPoolReference href="'.$conf->{np_href}.'"/>' : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1091 | 0 | ▶ | my $res_mem = defined $conf->{ResourceGuaranteedMemory} ? '<ResourceGuaranteedMemory>'.$conf->{ResourceGuaranteedMemory}."</ResourceGuaranteedMemory>\n" : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1092 | 0 | ▶ | my $res_cpu = defined $conf->{ResourceGuaranteedCpu} ? '<ResourceGuaranteedCpu>'.$conf->{ResourceGuaranteedCpu}."</ResourceGuaranteedCpu>\n" : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1093 | 0 | ▶ | my $vcpu = defined $conf->{VCpuInMhz} ? '<VCpuInMhz>'.$conf->{VCpuInMhz}."</VCpuInMhz>\n" : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1094 | 0 | ▶ | my $thin = defined $conf->{is_thin_provision} ? '<IsThinProvision>'.$conf->{is_thin_provision}."</IsThinProvision>\n" : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1095 | 0 | ▶ | my $pvdc = $conf->{pvdc_href} ? '<ProviderVdcReference name="'.$conf->{pvdc_name}.'" href="'.$conf->{pvdc_href}."\" />\n" : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1096 | 0 | ▶ | my $fast = defined $conf->{use_fast_provisioning} ? '<UsesFastProvisioning>'.$conf->{use_fast_provisioning}."</UsesFastProvisioning>\n" : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||
| 1098 | 0 | ▶ | if ( defined $conf->{sp} and ref $conf->{sp} ) { | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition0%0/3
defined $conf->{"sp"} and ref $conf->{"sp"}
MC/DC0%0/2
defined $conf->{"sp"} and ref $conf->{"sp"}
defined $conf->{"sp"}
ref $conf->{"sp"}
Truth table0%0/3
A and B
A= defined $conf->{"sp"}B= ref $conf->{"sp"}
| |||||||||||||||||||||||||||||||||
| 1099 | 0 | for my $ref ( @{$conf->{sp}} ) { | |||||||||||||||||||||||||||||||
| 1100 | $sp .= '<VdcStorageProfile> | ||||||||||||||||||||||||||||||||
| 1101 | <Enabled>'.$ref->{sp_enabled}.'</Enabled> | ||||||||||||||||||||||||||||||||
| 1102 | <Units>'.$ref->{sp_units}.'</Units> | ||||||||||||||||||||||||||||||||
| 1103 | <Limit>'.$ref->{sp_limit}.'</Limit> | ||||||||||||||||||||||||||||||||
| 1104 | <Default>'.$ref->{sp_default}.'</Default> | ||||||||||||||||||||||||||||||||
| 1105 | 0 | <ProviderVdcStorageProfile href="'.$ref->{sp_href}.'" /> | |||||||||||||||||||||||||||||||
| 1106 | </VdcStorageProfile>'; | ||||||||||||||||||||||||||||||||
| 1107 | } | ||||||||||||||||||||||||||||||||
| 1108 | } elsif ( defined $conf->{sp_enabled} ) { | ||||||||||||||||||||||||||||||||
| 1109 | $sp = '<VdcStorageProfile> | ||||||||||||||||||||||||||||||||
| 1110 | <Enabled>'.$conf->{sp_enabled}.'</Enabled> | ||||||||||||||||||||||||||||||||
| 1111 | <Units>'.$conf->{sp_units}.'</Units> | ||||||||||||||||||||||||||||||||
| 1112 | <Limit>'.$conf->{sp_limit}.'</Limit> | ||||||||||||||||||||||||||||||||
| 1113 | <Default>'.$conf->{sp_default}.'</Default> | ||||||||||||||||||||||||||||||||
| 1114 | 0 | <ProviderVdcStorageProfile href="'.$conf->{sp_href}.'" /> | |||||||||||||||||||||||||||||||
| 1115 | </VdcStorageProfile>'; | ||||||||||||||||||||||||||||||||
| 1116 | } | ||||||||||||||||||||||||||||||||
| 1117 | |||||||||||||||||||||||||||||||||
| 1118 | 0 | ▶ | if ( defined $conf->{cpu_unit} or defined $conf->{mem_unit} ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
defined $conf->{"cpu_unit"} or defined $conf->{"mem_unit"}
MC/DC0%0/2
defined $conf->{"cpu_unit"} or defined $conf->{"mem_unit"}
defined $conf->{"cpu_unit"}
defined $conf->{"mem_unit"}
Truth table0%0/3
A or B
A= defined $conf->{"cpu_unit"}B= defined $conf->{"mem_unit"}
| |||||||||||||||||||||||||||||||||
| 1119 | $compute = ' <ComputeCapacity> | ||||||||||||||||||||||||||||||||
| 1120 | <Cpu> | ||||||||||||||||||||||||||||||||
| 1121 | <Units>'.$conf->{cpu_unit}.'</Units> | ||||||||||||||||||||||||||||||||
| 1122 | <Allocated>'.$conf->{cpu_alloc}.'</Allocated> | ||||||||||||||||||||||||||||||||
| 1123 | <Limit>'.$conf->{cpu_limit}.'</Limit> | ||||||||||||||||||||||||||||||||
| 1124 | </Cpu> | ||||||||||||||||||||||||||||||||
| 1125 | <Memory> | ||||||||||||||||||||||||||||||||
| 1126 | <Units>'.$conf->{mem_unit}.'</Units> | ||||||||||||||||||||||||||||||||
| 1127 | <Allocated>'.$conf->{mem_alloc}.'</Allocated> | ||||||||||||||||||||||||||||||||
| 1128 | 0 | <Limit>'.$conf->{mem_limit}."</Limit> | |||||||||||||||||||||||||||||||
| 1129 | </Memory> | ||||||||||||||||||||||||||||||||
| 1130 | </ComputeCapacity>\n"; | ||||||||||||||||||||||||||||||||
| 1131 | } | ||||||||||||||||||||||||||||||||
| 1132 | |||||||||||||||||||||||||||||||||
| 1133 | 0 | ▶ | my $href = $conf->{href} ? 'href="'.$conf->{href}.'"' : ''; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||
| 1135 | 0 | my $xml = '<AdminVdc xmlns="http://www.vmware.com/vcloud/v1.5" '.$href.' name="'.$conf->{name}."\">\n" | |||||||||||||||||||||||||||||||
| 1136 | . $desc | ||||||||||||||||||||||||||||||||
| 1137 | . $alloc | ||||||||||||||||||||||||||||||||
| 1138 | . $compute | ||||||||||||||||||||||||||||||||
| 1139 | . $nicquota | ||||||||||||||||||||||||||||||||
| 1140 | . $netquota | ||||||||||||||||||||||||||||||||
| 1141 | . $sp | ||||||||||||||||||||||||||||||||
| 1142 | . $res_mem | ||||||||||||||||||||||||||||||||
| 1143 | . $res_cpu | ||||||||||||||||||||||||||||||||
| 1144 | . $vcpu | ||||||||||||||||||||||||||||||||
| 1145 | . $thin | ||||||||||||||||||||||||||||||||
| 1146 | . $networkpool | ||||||||||||||||||||||||||||||||
| 1147 | . $pvdc | ||||||||||||||||||||||||||||||||
| 1148 | . $fast | ||||||||||||||||||||||||||||||||
| 1149 | . "</AdminVdc>\n"; | ||||||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||||||
| 1151 | 0 | my $ret = $self->put($url,'application/vnd.vmware.admin.vdc+xml',$xml); | |||||||||||||||||||||||||||||||
| 1152 | |||||||||||||||||||||||||||||||||
| 1153 | 0 | ▶ | return $ret->[2]->{href} if $ret->[1] == 201; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1154 | 0 | return $ret; | |||||||||||||||||||||||||||||||
| 1155 | } | ||||||||||||||||||||||||||||||||
| 1156 | |||||||||||||||||||||||||||||||||
| 1157 | =head2 pdvc_get($href) | ||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||
| 1159 | =cut | ||||||||||||||||||||||||||||||||
| 1160 | |||||||||||||||||||||||||||||||||
| 1161 | 0 | ▶ | sub pvdc_get { | ||||||||||||||||||||||||||||||
|
Subroutine
pvdc_get: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 1162 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 1163 | 0 | my $tmpl = shift @_; | |||||||||||||||||||||||||||||||
| 1164 | 0 | ▶ | $self->_debug("API: pvdc_get($tmpl)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1165 | 0 | ▶ | return $self->get( $tmpl =~ /^[^\/]+$/ ? $self->{url_base} . 'tmpl/' . $tmpl : $tmpl ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1166 | } | ||||||||||||||||||||||||||||||||
| 1167 | |||||||||||||||||||||||||||||||||
| 1168 | =head2 task_get($href) | ||||||||||||||||||||||||||||||||
| 1169 | |||||||||||||||||||||||||||||||||
| 1170 | Returns information on the task. | ||||||||||||||||||||||||||||||||
| 1171 | |||||||||||||||||||||||||||||||||
| 1172 | =cut | ||||||||||||||||||||||||||||||||
| 1173 | |||||||||||||||||||||||||||||||||
| 1174 | # http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.reference.doc_51/doc/operations/GET-Task.html | ||||||||||||||||||||||||||||||||
| 1175 | |||||||||||||||||||||||||||||||||
| 1176 | 0 | ▶ | sub task_get { | ||||||||||||||||||||||||||||||
|
Subroutine
task_get: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1177 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 1178 | 0 | my $href = shift @_; | |||||||||||||||||||||||||||||||
| 1179 | 0 | ▶ | $self->_debug("API: task_get($href)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1180 | 0 | return $self->get($href); | |||||||||||||||||||||||||||||||
| 1181 | } | ||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||
| 1183 | |||||||||||||||||||||||||||||||||
| 1184 | =head2 template_get($templateid or $templateurl) | ||||||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||||||
| 1186 | As a parameter, this method thakes the raw numeric id of the template or the full URL. | ||||||||||||||||||||||||||||||||
| 1187 | |||||||||||||||||||||||||||||||||
| 1188 | It returns the requested template. | ||||||||||||||||||||||||||||||||
| 1189 | |||||||||||||||||||||||||||||||||
| 1190 | =cut | ||||||||||||||||||||||||||||||||
| 1191 | |||||||||||||||||||||||||||||||||
| 1192 | # http://pubs.vmware.com/vcd-51/index.jsp?topic=%2Fcom.vmware.vcloud.api.reference.doc_51%2Fdoc%2Foperations%2FGET-VAppTemplate.html | ||||||||||||||||||||||||||||||||
| 1193 | |||||||||||||||||||||||||||||||||
| 1194 | 0 | ▶ | sub template_get { | ||||||||||||||||||||||||||||||
|
Subroutine
template_get: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1195 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 1196 | 0 | my $tmpl = shift @_; | |||||||||||||||||||||||||||||||
| 1197 | 0 | ▶ | $self->_debug("API: template_get($tmpl)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1198 | 0 | ▶ | return $self->get( $tmpl =~ /^[^\/]+$/ ? $self->{url_base} . 'tmpl/' . $tmpl : $tmpl ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1199 | } | ||||||||||||||||||||||||||||||||
| 1200 | |||||||||||||||||||||||||||||||||
| 1201 | =head2 template_get_metadata($tmpl_href) | ||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||
| 1203 | Returns the response for metadata for the given template href. | ||||||||||||||||||||||||||||||||
| 1204 | |||||||||||||||||||||||||||||||||
| 1205 | HREF example: http://example.vcd.server/api/vAppTemplate/{uuid} | ||||||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||||||
| 1207 | =cut | ||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||
| 1209 | # http://www.vmware.com/support/vcd/doc/rest-api-doc-1.5-html/operations/GET-VAppTemplateMetadata.html | ||||||||||||||||||||||||||||||||
| 1210 | |||||||||||||||||||||||||||||||||
| 1211 | 0 | ▶ | sub template_get_metadata { | ||||||||||||||||||||||||||||||
|
Subroutine
template_get_metadata: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1212 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 1213 | 0 | my $href = shift @_; | |||||||||||||||||||||||||||||||
| 1214 | 0 | ▶ | $self->_debug("API: template_get_metadata($href)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1215 | 0 | return $self->get( $href . '/metadata' ); | |||||||||||||||||||||||||||||||
| 1216 | } | ||||||||||||||||||||||||||||||||
| 1217 | |||||||||||||||||||||||||||||||||
| 1218 | =head2 vdc_get($vdcid or $vdcurl) | ||||||||||||||||||||||||||||||||
| 1219 | |||||||||||||||||||||||||||||||||
| 1220 | As a parameter, this method thakes the raw numeric id of the virtual data center or the full URL detailed a catalog. | ||||||||||||||||||||||||||||||||
| 1221 | |||||||||||||||||||||||||||||||||
| 1222 | It returns the requested VDC. | ||||||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||||||
| 1224 | =cut | ||||||||||||||||||||||||||||||||
| 1225 | |||||||||||||||||||||||||||||||||
| 1226 | 0 | ▶ | sub vdc_get { | ||||||||||||||||||||||||||||||
|
Subroutine
vdc_get: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1227 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 1228 | 0 | my $vdc = shift @_; | |||||||||||||||||||||||||||||||
| 1229 | 0 | ▶ | $self->_debug("API: vdc_get($vdc)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1230 | 0 | ▶ | return $self->get( $vdc =~ /^[^\/]+$/ ? $self->{url_base} . 'vdc/' . $vdc : $vdc ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1231 | } | ||||||||||||||||||||||||||||||||
| 1232 | |||||||||||||||||||||||||||||||||
| 1233 | =head2 vdc_list() | ||||||||||||||||||||||||||||||||
| 1234 | |||||||||||||||||||||||||||||||||
| 1235 | Returns the full list of available VDCs. | ||||||||||||||||||||||||||||||||
| 1236 | |||||||||||||||||||||||||||||||||
| 1237 | =cut | ||||||||||||||||||||||||||||||||
| 1238 | |||||||||||||||||||||||||||||||||
| 1239 | 0 | ▶ | sub vdc_list { | ||||||||||||||||||||||||||||||
|
Subroutine
vdc_list: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1240 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 1241 | 0 | ▶ | $self->_debug("API: vdc_list()\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1242 | 0 | return $self->get( $self->{learned}->{url}->{admin} . 'vdcs/query' ); | |||||||||||||||||||||||||||||||
| 1243 | } | ||||||||||||||||||||||||||||||||
| 1244 | |||||||||||||||||||||||||||||||||
| 1245 | =head2 vapp_create_from_template($url,$name,$netid,$fencemode,$template_href,$IpAddressAllocationMode,$vcdid,$tmplid) | ||||||||||||||||||||||||||||||||
| 1246 | |||||||||||||||||||||||||||||||||
| 1247 | Create a vapp from a vapp template. | ||||||||||||||||||||||||||||||||
| 1248 | |||||||||||||||||||||||||||||||||
| 1249 | Given a name, VDC, template and network, instantiate the vapp template with the given | ||||||||||||||||||||||||||||||||
| 1250 | settings and other defaults. | ||||||||||||||||||||||||||||||||
| 1251 | |||||||||||||||||||||||||||||||||
| 1252 | * Fencemode can be: bridged, isolated, or natRouted | ||||||||||||||||||||||||||||||||
| 1253 | * IP Allocation mode can be: NONE, MANUAL, POOL, DHCP | ||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||
| 1255 | An array(ref) is returned. The first element is the task href, if one was | ||||||||||||||||||||||||||||||||
| 1256 | created. The second element is the HTTP reqest object returned by the server. | ||||||||||||||||||||||||||||||||
| 1257 | |||||||||||||||||||||||||||||||||
| 1258 | =cut | ||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||
| 1260 | # http://pubs.vmware.com/vcd-51/index.jsp?topic=%2Fcom.vmware.vcloud.api.reference.doc_51%2Fdoc%2Ftypes%2FInstantiateVAppTemplateParamsType.html | ||||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||
| 1262 | 0 | ▶ | sub vapp_create_from_template { | ||||||||||||||||||||||||||||||
|
Subroutine
vapp_create_from_template: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1263 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 1264 | 0 | my $url = shift @_; | |||||||||||||||||||||||||||||||
| 1265 | |||||||||||||||||||||||||||||||||
| 1266 | 0 | my $name = shift @_; | |||||||||||||||||||||||||||||||
| 1267 | 0 | my $netid = shift @_; | |||||||||||||||||||||||||||||||
| 1268 | 0 | my $fencemode = shift @_; | |||||||||||||||||||||||||||||||
| 1269 | 0 | my $template_href = shift @_; | |||||||||||||||||||||||||||||||
| 1270 | 0 | my $IpAddressAllocationMode = shift @_; | |||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||
| 1272 | 0 | my $vdcid = shift @_; | |||||||||||||||||||||||||||||||
| 1273 | 0 | my $tmplid = shift @_; | |||||||||||||||||||||||||||||||
| 1274 | |||||||||||||||||||||||||||||||||
| 1275 | 0 | ▶ | $self->_debug("API: vapp_create($url)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1276 | |||||||||||||||||||||||||||||||||
| 1277 | # XML to build | ||||||||||||||||||||||||||||||||
| 1278 | |||||||||||||||||||||||||||||||||
| 1279 | 0 | my $xml = '<InstantiateVAppTemplateParams name="'.$name.'" xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" > | |||||||||||||||||||||||||||||||
| 1280 | <Description>Example FTP Server vApp</Description> | ||||||||||||||||||||||||||||||||
| 1281 | <InstantiationParams> | ||||||||||||||||||||||||||||||||
| 1282 | <NetworkConfigSection> | ||||||||||||||||||||||||||||||||
| 1283 | <ovf:Info>Configuration parameters for vAppNetwork</ovf:Info> | ||||||||||||||||||||||||||||||||
| 1284 | <NetworkConfig networkName="vAppNetwork"> | ||||||||||||||||||||||||||||||||
| 1285 | <Configuration> | ||||||||||||||||||||||||||||||||
| 1286 | <ParentNetwork href="'.$netid.'"/> | ||||||||||||||||||||||||||||||||
| 1287 | <FenceMode>'.$fencemode.'</FenceMode> | ||||||||||||||||||||||||||||||||
| 1288 | </Configuration> | ||||||||||||||||||||||||||||||||
| 1289 | </NetworkConfig> | ||||||||||||||||||||||||||||||||
| 1290 | </NetworkConfigSection> | ||||||||||||||||||||||||||||||||
| 1291 | </InstantiationParams> | ||||||||||||||||||||||||||||||||
| 1292 | <Source href="'.$template_href.'"/> | ||||||||||||||||||||||||||||||||
| 1293 | </InstantiateVAppTemplateParams>'; | ||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||
| 1295 | 0 | my $ret = $self->post($url,'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml',$xml); | |||||||||||||||||||||||||||||||
| 1296 | 0 | my $task_href = $ret->[2]->{Tasks}->[0]->{Task}->{task}->{href}; | |||||||||||||||||||||||||||||||
| 1297 | 0 | ▶ | return wantarray ? ( $task_href, $ret ) : \( $task_href, $ret ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1298 | } | ||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||
| 1300 | =head2 vapp_create_from_sources($url,$name,$netid,$fencemode,$template_href,$IpAddressAllocationMode,$vcdid,$sourcesref) | ||||||||||||||||||||||||||||||||
| 1301 | |||||||||||||||||||||||||||||||||
| 1302 | Given one or more source HREFs, such as VMs withing in an existing template or | ||||||||||||||||||||||||||||||||
| 1303 | a VM catalog item, create a vApp. | ||||||||||||||||||||||||||||||||
| 1304 | |||||||||||||||||||||||||||||||||
| 1305 | Details of the create task will be returned. | ||||||||||||||||||||||||||||||||
| 1306 | |||||||||||||||||||||||||||||||||
| 1307 | * Fencemode can be: bridged, isolated, or natRouted | ||||||||||||||||||||||||||||||||
| 1308 | * IP Allocation mode can be: NONE, MANUAL, POOL, DHCP | ||||||||||||||||||||||||||||||||
| 1309 | |||||||||||||||||||||||||||||||||
| 1310 | =cut | ||||||||||||||||||||||||||||||||
| 1311 | |||||||||||||||||||||||||||||||||
| 1312 | # http://pubs.vmware.com/vcd-51/topic/com.vmware.vcloud.api.doc_51/GUID-9E04772F-2BA9-42A9-947D-4EE7A05A6EE0.html | ||||||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||||||
| 1314 | 0 | ▶ | sub vapp_create_from_sources { | ||||||||||||||||||||||||||||||
|
Subroutine
vapp_create_from_sources: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1315 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 1316 | 0 | my $url = shift @_; | |||||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||||||
| 1318 | 0 | my $name = shift @_; | |||||||||||||||||||||||||||||||
| 1319 | 0 | my $netid = shift @_; | |||||||||||||||||||||||||||||||
| 1320 | 0 | my $fencemode = shift @_; | |||||||||||||||||||||||||||||||
| 1321 | 0 | my $template_href = shift @_; | |||||||||||||||||||||||||||||||
| 1322 | 0 | my $IpAddressAllocationMode = shift @_; | |||||||||||||||||||||||||||||||
| 1323 | |||||||||||||||||||||||||||||||||
| 1324 | 0 | my $vdcid = shift @_; | |||||||||||||||||||||||||||||||
| 1325 | 0 | my $tmplid = shift @_; | |||||||||||||||||||||||||||||||
| 1326 | |||||||||||||||||||||||||||||||||
| 1327 | 0 | ▶ | $self->_debug("API: vapp_create($url)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1328 | |||||||||||||||||||||||||||||||||
| 1329 | # XML to build | ||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||
| 1331 | 0 | my $xml = '<ComposeVAppParams name="'.$name.'" xmlns="http://www.vmware.com/vcloud/v1" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1"> | |||||||||||||||||||||||||||||||
| 1332 | <InstantiationParams> | ||||||||||||||||||||||||||||||||
| 1333 | <NetworkConfigSection> | ||||||||||||||||||||||||||||||||
| 1334 | <ovf:Info>Configuration parameters for logical networks</ovf:Info> | ||||||||||||||||||||||||||||||||
| 1335 | <NetworkConfig networkName="'.$netid.'"> | ||||||||||||||||||||||||||||||||
| 1336 | <Configuration> | ||||||||||||||||||||||||||||||||
| 1337 | <ParentNetwork href="'.$netid.'"/> | ||||||||||||||||||||||||||||||||
| 1338 | <FenceMode>'.$fencemode.'</FenceMode> | ||||||||||||||||||||||||||||||||
| 1339 | </Configuration> | ||||||||||||||||||||||||||||||||
| 1340 | </NetworkConfig> | ||||||||||||||||||||||||||||||||
| 1341 | </NetworkConfigSection> | ||||||||||||||||||||||||||||||||
| 1342 | </InstantiationParams> | ||||||||||||||||||||||||||||||||
| 1343 | <Item> | ||||||||||||||||||||||||||||||||
| 1344 | <Source href="'.$template_href.'"/> | ||||||||||||||||||||||||||||||||
| 1345 | <InstantiationParams> | ||||||||||||||||||||||||||||||||
| 1346 | <NetworkConnectionSection | ||||||||||||||||||||||||||||||||
| 1347 | type="application/vnd.vmware.vcloud.networkConnectionSection+xml" | ||||||||||||||||||||||||||||||||
| 1348 | href="'.$template_href.'/networkConnectionSection/" ovf:required="false"> | ||||||||||||||||||||||||||||||||
| 1349 | <ovf:Info/> | ||||||||||||||||||||||||||||||||
| 1350 | <PrimaryNetworkConnectionIndex>0</PrimaryNetworkConnectionIndex> | ||||||||||||||||||||||||||||||||
| 1351 | <NetworkConnection network="'.$netid.'"> | ||||||||||||||||||||||||||||||||
| 1352 | <NetworkConnectionIndex>0</NetworkConnectionIndex> | ||||||||||||||||||||||||||||||||
| 1353 | <IsConnected>true</IsConnected> | ||||||||||||||||||||||||||||||||
| 1354 | <IpAddressAllocationMode>'.$IpAddressAllocationMode.'</IpAddressAllocationMode> | ||||||||||||||||||||||||||||||||
| 1355 | </NetworkConnection> | ||||||||||||||||||||||||||||||||
| 1356 | </NetworkConnectionSection> | ||||||||||||||||||||||||||||||||
| 1357 | </InstantiationParams> | ||||||||||||||||||||||||||||||||
| 1358 | |||||||||||||||||||||||||||||||||
| 1359 | </Item> | ||||||||||||||||||||||||||||||||
| 1360 | <AllEULAsAccepted>true</AllEULAsAccepted> | ||||||||||||||||||||||||||||||||
| 1361 | </ComposeVAppParams>'; | ||||||||||||||||||||||||||||||||
| 1362 | |||||||||||||||||||||||||||||||||
| 1363 | 0 | my $xml = ' | |||||||||||||||||||||||||||||||
| 1364 | <InstantiateVAppTemplateParams name="'.$name.'" xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" > | ||||||||||||||||||||||||||||||||
| 1365 | <Description>Example FTP Server vApp</Description> | ||||||||||||||||||||||||||||||||
| 1366 | <InstantiationParams> | ||||||||||||||||||||||||||||||||
| 1367 | <NetworkConfigSection> | ||||||||||||||||||||||||||||||||
| 1368 | <ovf:Info>Configuration parameters for vAppNetwork</ovf:Info> | ||||||||||||||||||||||||||||||||
| 1369 | <NetworkConfig networkName="vAppNetwork"> | ||||||||||||||||||||||||||||||||
| 1370 | <Configuration> | ||||||||||||||||||||||||||||||||
| 1371 | <ParentNetwork href="'.$netid.'"/> | ||||||||||||||||||||||||||||||||
| 1372 | <FenceMode>'.$fencemode.'</FenceMode> | ||||||||||||||||||||||||||||||||
| 1373 | </Configuration> | ||||||||||||||||||||||||||||||||
| 1374 | </NetworkConfig> | ||||||||||||||||||||||||||||||||
| 1375 | </NetworkConfigSection> | ||||||||||||||||||||||||||||||||
| 1376 | </InstantiationParams> | ||||||||||||||||||||||||||||||||
| 1377 | <Source href="'.$template_href.'"/> | ||||||||||||||||||||||||||||||||
| 1378 | </InstantiateVAppTemplateParams> | ||||||||||||||||||||||||||||||||
| 1379 | '; | ||||||||||||||||||||||||||||||||
| 1380 | |||||||||||||||||||||||||||||||||
| 1381 | 0 | return $self->post($url,'application/vnd.vmware.vcloud.instantiateVAppTemplateParams+xml',$xml); | |||||||||||||||||||||||||||||||
| 1382 | } | ||||||||||||||||||||||||||||||||
| 1383 | |||||||||||||||||||||||||||||||||
| 1384 | =head2 vapp_get($vappid or $vapp_href) | ||||||||||||||||||||||||||||||||
| 1385 | |||||||||||||||||||||||||||||||||
| 1386 | As a parameter, this method thakes the raw numeric id of the vApp or the full URL. | ||||||||||||||||||||||||||||||||
| 1387 | |||||||||||||||||||||||||||||||||
| 1388 | It returns the requested vApp. | ||||||||||||||||||||||||||||||||
| 1389 | |||||||||||||||||||||||||||||||||
| 1390 | =cut | ||||||||||||||||||||||||||||||||
| 1391 | |||||||||||||||||||||||||||||||||
| 1392 | 0 | ▶ | sub vapp_get { | ||||||||||||||||||||||||||||||
|
Subroutine
vapp_get: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1393 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 1394 | 0 | my $vapp = shift @_; | |||||||||||||||||||||||||||||||
| 1395 | 0 | my $req; | |||||||||||||||||||||||||||||||
| 1396 | |||||||||||||||||||||||||||||||||
| 1397 | 0 | ▶ | $self->_debug("API: vapp_get($vapp)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1398 | 0 | ▶ | return $self->get( $vapp =~ /^[^\/]+$/ ? $self->{url_base} . 'vApp/vapp-' . $vapp : $vapp ); | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1399 | } | ||||||||||||||||||||||||||||||||
| 1400 | |||||||||||||||||||||||||||||||||
| 1401 | =head2 vapp_get_metadata($vapp_href) | ||||||||||||||||||||||||||||||||
| 1402 | |||||||||||||||||||||||||||||||||
| 1403 | Returns the response for metadata for the given vApp href. | ||||||||||||||||||||||||||||||||
| 1404 | |||||||||||||||||||||||||||||||||
| 1405 | HREF example: http://example.vcd.server/api/vApp/{uuid} | ||||||||||||||||||||||||||||||||
| 1406 | |||||||||||||||||||||||||||||||||
| 1407 | =cut | ||||||||||||||||||||||||||||||||
| 1408 | |||||||||||||||||||||||||||||||||
| 1409 | # http://pubs.vmware.com/vcd-51/index.jsp?topic=%2Fcom.vmware.vcloud.api.reference.doc_51%2Fdoc%2Foperations%2FGET-VAppMetadata.html | ||||||||||||||||||||||||||||||||
| 1410 | |||||||||||||||||||||||||||||||||
| 1411 | 0 | ▶ | sub vapp_get_metadata { | ||||||||||||||||||||||||||||||
|
Subroutine
vapp_get_metadata: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1412 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 1413 | 0 | my $href = shift @_; | |||||||||||||||||||||||||||||||
| 1414 | 0 | ▶ | $self->_debug("API: vapp_get_metadata($href)\n") if $self->{debug}; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 1415 | 0 | return $self->get( $href . '/metadata' ); | |||||||||||||||||||||||||||||||
| 1416 | } | ||||||||||||||||||||||||||||||||
| 1417 | |||||||||||||||||||||||||||||||||
| 1418 | =head2 vapp_recompose_add_vm($href,$vapp_name,$vapp_href,$vm_name_to_be,$vm_current_href) | ||||||||||||||||||||||||||||||||
| 1419 | |||||||||||||||||||||||||||||||||
| 1420 | Returns a task. | ||||||||||||||||||||||||||||||||
| 1421 | |||||||||||||||||||||||||||||||||
| 1422 | VM should be powered off to work. | ||||||||||||||||||||||||||||||||
| 1423 | |||||||||||||||||||||||||||||||||
| 1424 | =cut | ||||||||||||||||||||||||||||||||
| 1425 | |||||||||||||||||||||||||||||||||
| 1426 | # POST /vApp/{id}/action/recomposeVApp | ||||||||||||||||||||||||||||||||
| 1427 | # http://www.vmware.com/support/vcd/doc/rest-api-doc-1.5-html/types/RecomposeVAppParamsType.html | ||||||||||||||||||||||||||||||||
| 1428 | |||||||||||||||||||||||||||||||||
| 1429 | 0 | ▶ | sub vapp_recompose_add_vm { | ||||||||||||||||||||||||||||||
|
Subroutine
vapp_recompose_add_vm: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||
| 1430 | 0 | my $self = shift @_; | |||||||||||||||||||||||||||||||
| 1431 | 0 | my $vapp_name = shift @_; | |||||||||||||||||||||||||||||||
| 1432 | 0 | my $vapp_href = shift @_; | |||||||||||||||||||||||||||||||
| 1433 | 0 | my $vm_name = shift @_; | |||||||||||||||||||||||||||||||
| 1434 | 0 | my $vm_href = shift @_; | |||||||||||||||||||||||||||||||
| 1435 | |||||||||||||||||||||||||||||||||
| 1436 | 0 | my $network = shift @_; | |||||||||||||||||||||||||||||||
| 1437 | 0 | my $storageProfile = shift @_; | |||||||||||||||||||||||||||||||
| 1438 | |||||||||||||||||||||||||||||||||
| 1439 | 0 | my $desc = ''; | |||||||||||||||||||||||||||||||
| 1440 | |||||||||||||||||||||||||||||||||
| 1441 | 0 | my $xml = '<RecomposeVAppParams xmlns="http://www.vmware.com/vcloud/v1.5" xmlns:ovf="http://schemas.dmtf.org/ovf/envelope/1" > | |||||||||||||||||||||||||||||||
| 1442 | <Description>'.$desc.'</Description> | ||||||||||||||||||||||||||||||||
| 1443 | <SourcedItem sourceDelete="0"> | ||||||||||||||||||||||||||||||||
| 1444 | <Source href="'.$vm_href.'" name="'.$vm_name.'" /> | ||||||||||||||||||||||||||||||||
| 1445 | </SourcedItem> | ||||||||||||||||||||||||||||||||
| 1446 | <AllEULAsAccepted> 1 </AllEULAsAccepted> | ||||||||||||||||||||||||||||||||
| 1447 | <CreateItem href="'.$vapp_href.'" name="'.$vapp_name.'"> | ||||||||||||||||||||||||||||||||
| 1448 | <Description>".$desc."</Description> | ||||||||||||||||||||||||||||||||
| 1449 | <StorageProfile href="'.$storageProfile.'"/> | ||||||||||||||||||||||||||||||||
| 1450 | </CreateItem> | ||||||||||||||||||||||||||||||||
| 1451 | </RecomposeVAppParams>'; | ||||||||||||||||||||||||||||||||
| 1452 | |||||||||||||||||||||||||||||||||
| 1453 | 0 | return $self->post($vapp_href . '/action/recomposeVApp','application/vnd.vmware.vcloud.recomposeVAppParams+xml',$xml); | |||||||||||||||||||||||||||||||
| 1454 | } | ||||||||||||||||||||||||||||||||
| 1455 | |||||||||||||||||||||||||||||||||
| 1456 | 2 | 1; | |||||||||||||||||||||||||||||||
| 1457 | |||||||||||||||||||||||||||||||||
| 1458 | __END__ | ||||||||||||||||||||||||||||||||