| 1 | package VM::EC2::REST::placement_group; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use VM::EC2 ''; # important not to import anything! | ||
| 5 | package VM::EC2; # add methods to VM::EC2 | ||
| 6 | |||
| 7 | VM::EC2::Dispatch->register( | ||
| 8 | CreatePlacementGroup => 'boolean', | ||
| 9 | DeletePlacementGroup => 'boolean', | ||
| 10 | DescribePlacementGroups => 'fetch_items,placementGroupSet,VM::EC2::PlacementGroup', | ||
| 11 | ); | ||
| 12 | |||
| 13 | =head1 NAME VM::EC2::REST::placement_group | ||
| 14 | |||
| 15 | =head1 SYNOPSIS | ||
| 16 | |||
| 17 | use VM::EC2 ':hpc' | ||
| 18 | |||
| 19 | =head1 METHODS | ||
| 20 | |||
| 21 | Placement groups provide low latency and high-bandwidth connectivity | ||
| 22 | between cluster instances within a single Availability Zone. Create | ||
| 23 | a placement group and then launch cluster instances into it. Instances | ||
| 24 | launched within a placement group participate in a full-bisection | ||
| 25 | bandwidth cluster appropriate for HPC applications. | ||
| 26 | |||
| 27 | Implemented: | ||
| 28 | CreatePlacementGroup | ||
| 29 | DeletePlacementGroup | ||
| 30 | DescribePlacementGroups | ||
| 31 | |||
| 32 | =head2 @groups = $ec2->describe_placement_groups(@group_names) | ||
| 33 | |||
| 34 | =head2 @groups = $ec2->describe_placement_groups(\%filters) | ||
| 35 | |||
| 36 | =head2 @groups = $ec2->describe_placement_groups(-group_name=>\@ids,-filter=>\%filters) | ||
| 37 | |||
| 38 | This method will return information about cluster placement groups | ||
| 39 | as a list of VM::EC2::PlacementGroup objects. | ||
| 40 | |||
| 41 | Optional arguments: | ||
| 42 | |||
| 43 | -group_name -- Scalar or arrayref of placement group names. | ||
| 44 | |||
| 45 | -filter -- Tags and other filters to apply. | ||
| 46 | |||
| 47 | The filters available are described fully at: | ||
| 48 | http://docs.amazonwebservices.com/AWSEC2/latest/APIReference/ApiReference-query-DescribePlacementGroups.html | ||
| 49 | |||
| 50 | group-name | ||
| 51 | state | ||
| 52 | strategy | ||
| 53 | |||
| 54 | =cut | ||
| 55 | |||
| 56 | sub describe_placement_groups { | ||
| 57 | my $self = shift; | ||
| 58 | my %args = $self->args('-group_name',@_); | ||
| 59 | my @params = $self->list_parm('GroupName',\%args); | ||
| 60 | push @params,$self->filter_parm(\%args); | ||
| 61 | return $self->call('DescribePlacementGroups',@params); | ||
| 62 | } | ||
| 63 | |||
| 64 | =head2 $success = $ec2->create_placement_group($group_name) | ||
| 65 | |||
| 66 | =head2 $success = $ec2->create_placement_group(-group_name=>$name,-strategy=>$strategy) | ||
| 67 | |||
| 68 | Creates a placement group that cluster instances are launched into. | ||
| 69 | |||
| 70 | Required arguments: | ||
| 71 | -group_name -- The name of the placement group to create | ||
| 72 | |||
| 73 | Optional: | ||
| 74 | -strategy -- As of 2012-12-23, the only available option is 'cluster' | ||
| 75 | so the parameter defaults to that. | ||
| 76 | |||
| 77 | Returns true on success. | ||
| 78 | |||
| 79 | =cut | ||
| 80 | |||
| 81 | sub create_placement_group { | ||
| 82 | my $self = shift; | ||
| 83 | my %args = $self->args('-group_name',@_); | ||
| 84 | $args{-strategy} ||= 'cluster'; | ||
| 85 | my @params = $self->single_parm('GroupName',\%args); | ||
| 86 | push @params, $self->single_parm('Strategy',\%args); | ||
| 87 | return $self->call('CreatePlacementGroup',@params); | ||
| 88 | } | ||
| 89 | |||
| 90 | =head2 $success = $ec2->delete_placement_group($group_name) | ||
| 91 | |||
| 92 | =head2 $success = $ec2->delete_placement_group(-group_name=>$group_name) | ||
| 93 | |||
| 94 | Deletes a placement group from the account. | ||
| 95 | |||
| 96 | Required arguments: | ||
| 97 | -group_name -- The name of the placement group to delete | ||
| 98 | |||
| 99 | Returns true on success. | ||
| 100 | |||
| 101 | =cut | ||
| 102 | |||
| 103 | sub delete_placement_group { | ||
| 104 | my $self = shift; | ||
| 105 | my %args = $self->args('-group_name',@_); | ||
| 106 | my @params = $self->single_parm('GroupName',\%args); | ||
| 107 | return $self->call('DeletePlacementGroup',@params); | ||
| 108 | } | ||
| 109 | |||
| 110 | =head1 SEE ALSO | ||
| 111 | |||
| 112 | L<VM::EC2> | ||
| 113 | |||
| 114 | =head1 AUTHOR | ||
| 115 | |||
| 116 | Lincoln Stein E<lt>lincoln.stein@gmail.comE<gt>. | ||
| 117 | |||
| 118 | Copyright (c) 2011 Ontario Institute for Cancer Research | ||
| 119 | |||
| 120 | This package and its accompanying libraries is free software; you can | ||
| 121 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 122 | version 1, or at your option, any later version) or the Artistic | ||
| 123 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 124 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 125 | |||
| 126 | =cut | ||
| 127 | |||
| 128 | |||
| 129 | 1; |