1package VM::EC2::DB::Option::Group::Option;
2
3=head1 NAME
4
5VM::EC2::DB::Option::Group::Option - An RDS Database Option Group Option
6
7=head1 SYNOPSIS
8
9 use VM::EC2;
10
11 $ec2 = VM::EC2->new(...);
12 @options = $ec2->describe_option_group_options(-engine_name => 'oracle-se1');
13 foreach $option (@options) {
14   print $option->Name,' ',$option->MajorEngineVersion,"\n";
15 }
16
17=head1 DESCRIPTION
18
19This object represents an Option Group Option, as returned by the
20VM::EC2->describe_option_group_options() call.
21
22=head1 STRING OVERLOADING
23
24In string context, the object returns the Option Name.
25
26=head1 SEE ALSO
27
28L<VM::EC2>
29L<VM::EC2::Generic>
30L<VM::EC2::DB::Instance>
31
32=head1 AUTHOR
33
34Lance Kinley E<lt>lkinley@loyaltymethods.comE<gt>.
35
36Copyright (c) 2013 Loyalty Methods, Inc.
37
38This package and its accompanying libraries is free software; you can
39redistribute it and/or modify it under the terms of the GPL (either
40version 1, or at your option, any later version) or the Artistic
41License 2.0.  Refer to LICENSE for the full license text. In addition,
42please see DISCLAIMER.txt for disclaimers of warranty.
43
44=cut
45
46use strict;
47use base 'VM::EC2::Generic';
48use VM::EC2::DB::Option::Group::Option::Setting;
49
50use overload '""' => sub { shift->Name },
51    fallback => 1;
52
53sub valid_fields {
54    my $self = shift;
55    return qw(
56        DefaultPort
57        Description
58        EngineName
59        MajorEngineVersion
60        MinimumRequiredMinorEngineVersion
61        Name
62        OptionGroupOptionSettings
63        OptionsDependedOn
64        Persistent
65        PortRequired
66    );
67}
68
69sub OptionGroupOptionSettings {
70    my $self = shift;
71    my $settings = $self->SUPER::OptionGroupOptionSettings;
72    return unless $settings;
73    $settings = $settings->{OptionGroupOptionSetting};
74    return ref $settings eq 'HASH' ?
75        (VM::EC2::Option::Group::Option::Setting->new($settings,$self->aws)) :
76        map { VM::EC2::Option::Group::Option::Setting->new($_,$self->aws) } @$settings;
77}
78
79sub OptionsDependedOn {
80    my $self = shift;
81    my $depend = $self->SUPER::OptionsDependedOn;
82    return unless $depend;
83    $depend = $depend->{OptionName};
84    return ref $depend eq 'ARRAY' ? @$depend : ($depend);
85}
86
87sub Persistent {
88    my $self = shift;
89    my $p = $self->SUPER::Persistent;
90    return $p eq 'true';
91}
92
93sub PortRequired {
94    my $self = shift;
95    my $pr = $self->SUPER::PortRequired;
96    return $pr eq 'true';
97}
98
991;
100