Class: AWS::EC2::DHCPOptionsCollection

Inherits:
Collection
  • Object
show all
Includes:
Core::Collection::Simple, TaggedCollection
Defined in:
lib/aws/ec2/dhcp_options_collection.rb

Instance Method Summary collapse

Methods included from Core::Collection

#each, #each_batch, #enum, #first, #in_groups_of, #page

Methods included from TaggedCollection

#tagged, #tagged_values

Methods included from FilteredCollection

#filter, #initialize

Instance Method Details

#[](dhcp_options_id) ⇒ DHCPOptions

Parameters:

  • dhcp_options_id (String)

Returns:



67
68
69
# File 'lib/aws/ec2/dhcp_options_collection.rb', line 67

def [] dhcp_options_id
  DHCPOptions.new(dhcp_options_id, :config => config)
end

#create(options = {}) ⇒ Object

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :domain_name (required, String)

    A domain name of your choice (e.g., example.com).

  • :domain_name_servers (Array<String>)

    The IP addresses of domain name servers. You can specify up to four addresses.

  • :ntp_servers (Array<String>)

    The IP addresses of Network Time Protocol (NTP) servers. You can specify up to four addresses.

  • :netbios_name_servers (Array<String>)

    The IP addresses of NetBIOS name servers. You can specify up to four addresses.

  • :netbios_node_type (String)

    Value indicating the NetBIOS node type (1, 2, 4, or 8). For more information about the values, go to RFC 2132. We recommend you only use 2 at this time (broadcast and multicast are currently not supported).



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/aws/ec2/dhcp_options_collection.rb', line 44

def create options = {}

  configurations = []
  options.each_pair do |opt,values|
    opt = opt.to_s.gsub(/_/, '-')
    values = values.is_a?(Array) ? values : [values]
    configurations << { :key => opt, :values => values.map(&:to_s) }
  end

  client_opts = {}
  client_opts[:dhcp_configurations] = configurations

  resp = client.create_dhcp_options(client_opts)

  DHCPOptions.new_from(:create_dhcp_options,
    resp.dhcp_options,
    resp.dhcp_options.dhcp_options_id,
    :config => config)

end