| 1 | package VM::EC2::DB::Instance::OrderableOption; | ||
| 2 | |||
| 3 | =head1 NAME | ||
| 4 | |||
| 5 | VM::EC2::DB::Instance::OrderableOption - An RDS Database Orderable Option | ||
| 6 | |||
| 7 | =head1 SYNOPSIS | ||
| 8 | |||
| 9 | use VM::EC2; | ||
| 10 | |||
| 11 | $ec2 = VM::EC2->new(...); | ||
| 12 | @options = $ec2->describe_orderable_db_instance_options(-engine => 'mysql'); | ||
| 13 | foreach $option (grep { $_->MultiAZCapable } @options) { | ||
| 14 | print $option->EngineVersion,' ', | ||
| 15 | $option->DBInstanceClass,' ', | ||
| 16 | join(',',grep { $_->ProvisionedIopsCapable } $option->AvailabilityZones), | ||
| 17 | "\n"; | ||
| 18 | } | ||
| 19 | |||
| 20 | =head1 DESCRIPTION | ||
| 21 | |||
| 22 | This object represents a DB Instance Orderable Option, as returned by the | ||
| 23 | VM::EC2->describe_orderable_db_instance_options() call. | ||
| 24 | |||
| 25 | =head1 STRING OVERLOADING | ||
| 26 | |||
| 27 | none | ||
| 28 | |||
| 29 | =head1 SEE ALSO | ||
| 30 | |||
| 31 | L<VM::EC2> | ||
| 32 | L<VM::EC2::Generic> | ||
| 33 | L<VM::EC2::DB::Instance> | ||
| 34 | |||
| 35 | =head1 AUTHOR | ||
| 36 | |||
| 37 | Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>. | ||
| 38 | |||
| 39 | Copyright (c) 2013 Loyalty Methods, Inc. | ||
| 40 | |||
| 41 | This package and its accompanying libraries is free software; you can | ||
| 42 | redistribute it and/or modify it under the terms of the GPL (either | ||
| 43 | version 1, or at your option, any later version) or the Artistic | ||
| 44 | License 2.0. Refer to LICENSE for the full license text. In addition, | ||
| 45 | please see DISCLAIMER.txt for disclaimers of warranty. | ||
| 46 | |||
| 47 | =cut | ||
| 48 | |||
| 49 | use strict; | ||
| 50 | use base 'VM::EC2::Generic'; | ||
| 51 | use VM::EC2::DB::AvailabilityZone; | ||
| 52 | |||
| 53 | sub valid_fields { | ||
| 54 | my $self = shift; | ||
| 55 | return qw( | ||
| 56 | AvailabilityZones | ||
| 57 | DBInstanceClass | ||
| 58 | Engine | ||
| 59 | EngineVersion | ||
| 60 | LicenseModel | ||
| 61 | MultiAZCapable | ||
| 62 | ReadReplicaCapable | ||
| 63 | Vpc | ||
| 64 | ); | ||
| 65 | } | ||
| 66 | |||
| 67 | sub AvailabilityZones { | ||
| 68 | my $self = shift; | ||
| 69 | my $azs = $self->SUPER::AvailabilityZones; | ||
| 70 | return unless $azs; | ||
| 71 | $azs = $azs->{AvailabilityZone}; | ||
| 72 | return ref $azs eq 'HASH' ? | ||
| 73 | (VM::EC2::DB::AvailabilityZone->new($azs,$self->aws)) : | ||
| 74 | map { VM::EC2::DB::AvailabilityZone->new($_,$self->aws) } @$azs; | ||
| 75 | } | ||
| 76 | |||
| 77 | sub MultiAZCapable { | ||
| 78 | my $self = shift; | ||
| 79 | my $maz = $self->SUPER::MultiAZCapable; | ||
| 80 | return $maz eq 'true'; | ||
| 81 | } | ||
| 82 | |||
| 83 | sub ReadReplicaCapable { | ||
| 84 | my $self = shift; | ||
| 85 | my $r = $self->SUPER::ReadReplicaCapable; | ||
| 86 | return $r eq 'true'; | ||
| 87 | } | ||
| 88 | |||
| 89 | sub Vpc { | ||
| 90 | my $self = shift; | ||
| 91 | my $v = $self->SUPER::Vpc; | ||
| 92 | return $v eq 'true'; | ||
| 93 | } | ||
| 94 | |||
| 95 | 1; |