Class: GeoEngineer::Resources::AwsApiGatewayRestApi

Inherits:
GeoEngineer::Resource show all
Includes:
ApiGatewayHelpers
Defined in:
lib/geoengineer/resources/aws_api_gateway_rest_api.rb

Overview

AwsCloudTrail is the api_gatewat_rest_api terrform resource,

https://www.terraform.io/docs/providers/aws/r/api_gateway_rest_api.html

Constant Summary

Constants inherited from GeoEngineer::Resource

GeoEngineer::Resource::DEFAULT_PROVIDER

Constants included from HasValidations

HasValidations::MAX_POLICY_LENGTH

Instance Attribute Summary collapse

Attributes inherited from GeoEngineer::Resource

#environment, #id, #project, #template, #type

Class Method Summary collapse

Instance Method Summary collapse

Methods included from ApiGatewayHelpers

_rest_api_cache, _rest_api_resource_cache, included

Methods inherited from GeoEngineer::Resource

_deep_symbolize_keys, #_find_remote_resource, _ignore_remote_resource?, #_json_file, #_normalize_json, _resources_to_ignore, build, #build_individual_remote_resource, clear_remote_resource_cache, #depends_on, #duplicate, #duplicate_resource, #fetch_provider, fetch_remote_resources, #find_remote_as_individual?, #for_resource, #in_project, #initialize, #matched_remote_resource, #merge_parent_tags, #merge_tags, #new?, #remote_resource, #remote_resource_params, #reset, #setup_tags_if_needed, #short_id, #short_name, #short_type, #terraform_name, #to_id_or_ref, #to_ref, #to_s, #to_terraform, #to_terraform_json, type_from_class_name, #validate_has_tag, #validate_required_subresource, #validate_subresource_required_attributes

Methods included from HasLifecycle

#execute_lifecycle, included

Methods included from HasValidations

#errors, included, #validate_at_least_one_present, #validate_cidr_block, #validate_only_one_present, #validate_policy_length, #validate_required_attributes

Methods included from HasSubResources

#assign_block, #attribute_missing, #delete_all_subresources, #delete_subresources_where, #subresources

Methods included from HasAttributes

#[], #[]=, #assign_attribute, #assign_block, #attribute_missing, #attribute_procs, #attributes, #delete, #eager_load_attributes, #method_missing, #reset_attributes, #retrieve_attribute, #terraform_attribute_ref, #terraform_attributes, #timeout

Constructor Details

This class inherits a constructor from GeoEngineer::Resource

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class HasAttributes

Instance Attribute Details

#api_resourcesObject

API Resource Methods


18
19
20
# File 'lib/geoengineer/resources/aws_api_gateway_rest_api.rb', line 18

def api_resources
  @api_resources
end

Class Method Details

._fetch_remote_resources(provider) ⇒ Object


76
77
78
# File 'lib/geoengineer/resources/aws_api_gateway_rest_api.rb', line 76

def self._fetch_remote_resources(provider)
  _fetch_remote_rest_apis(provider)
end

Instance Method Details

#all_api_resourcesObject


36
37
38
# File 'lib/geoengineer/resources/aws_api_gateway_rest_api.rb', line 36

def all_api_resources
  [self, @api_resources.values.map(&:values)].flatten
end

#all_core_api_resourcesObject


40
41
42
43
44
45
46
47
48
49
50
# File 'lib/geoengineer/resources/aws_api_gateway_rest_api.rb', line 40

def all_core_api_resources
  [
    self,
    @api_resources["aws_api_gateway_integration"].values,
    @api_resources["aws_api_gateway_integration_response"].values,
    @api_resources["aws_api_gateway_method"].values,
    @api_resources["aws_api_gateway_method_response"].values,
    @api_resources["aws_api_gateway_model"].values,
    @api_resources["aws_api_gateway_resource"].values
  ].flatten
end

#delete_uncodified_children_resouresObject

This method will tag for deletion all remote resources that are not codeified


70
71
72
73
74
# File 'lib/geoengineer/resources/aws_api_gateway_rest_api.rb', line 70

def delete_uncodified_children_resoures
  # Find all remote resources for this rest_api
  # Compare with api_resources hash
  # create resource in project tagged with deletion (this will only add them to tfstate)
end

#initialize_children_resourcesObject


21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/geoengineer/resources/aws_api_gateway_rest_api.rb', line 21

def initialize_children_resources
  # { <class_name> : { <resource_id> : <resource>}
  @api_resources = {
    "aws_api_gateway_authorizer" => {},
    "aws_api_gateway_base_path_mapping" => {},
    "aws_api_gateway_deployment" => {},
    "aws_api_gateway_integration" => {},
    "aws_api_gateway_integration_response" => {},
    "aws_api_gateway_method" => {},
    "aws_api_gateway_method_response" => {},
    "aws_api_gateway_model" => {},
    "aws_api_gateway_resource" => {}
  }
end

#root_resource_idObject


57
58
59
# File 'lib/geoengineer/resources/aws_api_gateway_rest_api.rb', line 57

def root_resource_id
  NullObject.maybe(remote_resource).root_resource_id
end

#support_tags?Boolean

End of API Resource Methods

Returns:

  • (Boolean)

53
54
55
# File 'lib/geoengineer/resources/aws_api_gateway_rest_api.rb', line 53

def support_tags?
  false
end

#to_terraform_stateObject


61
62
63
64
65
66
67
# File 'lib/geoengineer/resources/aws_api_gateway_rest_api.rb', line 61

def to_terraform_state
  tfstate = super
  tfstate[:primary][:attributes] = {
    "root_resource_id" => root_resource_id
  }
  tfstate
end