line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package VMware::vCloudDirector::Link; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# ABSTRACT: Link within the vCloud |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
1532
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
6
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
38
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.007'; # VERSION |
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:NIGELM'; # AUTHORITY |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
66
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
use Method::Signatures; |
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__ |