line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VMware::vCloudDirector::Link; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Link within the vCloud |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1635
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
6
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
74
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.006'; # VERSION |
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:NIGELM'; # AUTHORITY |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
6
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
6
|
|
12
|
1
|
|
|
1
|
|
6212
|
use Method::Signatures; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
use MooseX::Types::URI qw(Uri); |
14
|
|
|
|
|
|
|
use Ref::Util qw(is_plain_hashref); |
15
|
|
|
|
|
|
|
use VMware::vCloudDirector::Error; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# ------------------------------------------------------------------------ |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
has object => ( |
20
|
|
|
|
|
|
|
is => 'ro', |
21
|
|
|
|
|
|
|
isa => 'VMware::vCloudDirector::Object', |
22
|
|
|
|
|
|
|
required => 1, |
23
|
|
|
|
|
|
|
weak_ref => 1, |
24
|
|
|
|
|
|
|
documentation => 'Parent object of link' |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
has mime_type => ( is => 'ro', isa => 'Str', predicate => 'has_mime_type' ); |
28
|
|
|
|
|
|
|
has href => ( is => 'ro', isa => Uri, required => 1, coerce => 1 ); |
29
|
|
|
|
|
|
|
has rel => ( is => 'ro', isa => 'Str', required => 1 ); |
30
|
|
|
|
|
|
|
has name => ( is => 'ro', isa => 'Str', predicate => 'has_name' ); |
31
|
|
|
|
|
|
|
has type => ( is => 'ro', isa => 'Str' ); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# ------------------------------------------------------------------------ |
34
|
|
|
|
|
|
|
around BUILDARGS => sub { |
35
|
|
|
|
|
|
|
my ( $orig, $class, $first, @rest ) = @_; |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
my $params = is_plain_hashref($first) ? $first : { $first, @rest }; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
if ( $params->{hash} ) { |
40
|
|
|
|
|
|
|
my $hash = delete $params->{hash}; |
41
|
|
|
|
|
|
|
$params->{href} = $hash->{-href} if ( exists( $hash->{-href} ) ); |
42
|
|
|
|
|
|
|
$params->{rel} = $hash->{-rel} if ( exists( $hash->{-rel} ) ); |
43
|
|
|
|
|
|
|
$params->{name} = $hash->{-name} if ( exists( $hash->{-name} ) ); |
44
|
|
|
|
|
|
|
if ( exists( $hash->{-type} ) ) { |
45
|
|
|
|
|
|
|
my $type = $hash->{-type}; |
46
|
|
|
|
|
|
|
$params->{mime_type} = $type; |
47
|
|
|
|
|
|
|
$params->{type} = $1 if ( $type =~ m|^application/vnd\..*\.(\w+)\+xml$| ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
return $class->$orig($params); |
52
|
|
|
|
|
|
|
}; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
# ------------------------------------------------------------------------ |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
method DELETE () { return $self->object->api->GET( $self->href ); } |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
method GET () { return $self->object->api->GET( $self->href ); } |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
method POST ($xml_hash) { return $self->object->api->GET( $self->href, $xml_hash ); } |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
method PUT ($xml_hash) { return $self->object->api->GET( $self->href, $xml_hash ); } |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
# ------------------------------------------------------------------------ |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
1; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
__END__ |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
=pod |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
=encoding UTF-8 |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 NAME |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
VMware::vCloudDirector::Link - Link within the vCloud |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 VERSION |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
version 0.006 |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head3 DELETE |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Make a delete request to the URL in this link. Returns Objects. Failure will |
91
|
|
|
|
|
|
|
generate an exception. See L<VMware::vCloudDirector::API/DELETE>. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head3 GET |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Make a get request to the URL in this link. Returns Objects. Failure will |
96
|
|
|
|
|
|
|
generate an exception. See L<VMware::vCloudDirector::API/GET>. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head3 POST |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
Make a post request with the specified payload to the URL in this link. Returns |
101
|
|
|
|
|
|
|
Objects. Failure will generate an exception. See |
102
|
|
|
|
|
|
|
L<VMware::vCloudDirector::API/POST>. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head3 PUT |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
Make a put request with the specified payload to the URL in this link. Returns |
107
|
|
|
|
|
|
|
Objects. Failure will generate an exception. See |
108
|
|
|
|
|
|
|
L<VMware::vCloudDirector::API/PUT>. |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head1 AUTHOR |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
Nigel Metheringham <nigelm@cpan.org> |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
This software is copyright (c) 2017 by Nigel Metheringham. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
119
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=cut |