You are viewing documentation for version 2 of the AWS SDK for Ruby. Version 3 documentation can be found here.

Class: Aws::Resources::Definition

Inherits:
Object
  • Object
show all
Defined in:
aws-sdk-resources/lib/aws-sdk-resources/definition.rb

Overview

Given a resource definition document, a Definition can build a set of related resource classes.

Instance Method Summary collapse

Constructor Details

#initialize(definition = {}, options = {}) ⇒ Definition

Returns a new instance of Definition.

Parameters:

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

    a customizable set of options

Options Hash (options):

  • :source_path (String)


12
13
14
15
# File 'aws-sdk-resources/lib/aws-sdk-resources/definition.rb', line 12

def initialize(definition = {}, options = {})
  @source = definition
  @source_path = options[:source_path]
end

Instance Method Details

#apply(namespace) ⇒ void

This method returns an undefined value.

Parameters:



19
20
21
22
23
24
25
26
27
28
29
30
# File 'aws-sdk-resources/lib/aws-sdk-resources/definition.rb', line 19

def apply(namespace)
  build_resource_classes(namespace)
  each_resource_class(namespace) do |resource, definition|
    define_load(namespace, resource, definition['load'])
    define_actions(namespace, resource, definition['actions'] || {})
    define_batch_actions(namespace, resource, definition['batchActions'] || {})
    define_waiters(namespace, resource, definition['waiters'] || {})
    define_has(namespace, resource, definition['has'] || {})
    define_has_many(namespace, resource, definition['hasMany'] || {})
    define_data_attributes(namespace, resource, definition)
  end
end