Class: Chef::Provider::AwsCloudsearchDomain

Inherits:
Chef::Provisioning::AWSDriver::AWSProvider show all
Defined in:
lib/chef/provider/aws_cloudsearch_domain.rb

Constant Summary

Constants inherited from Chef::Provisioning::AWSDriver::AWSProvider

Chef::Provisioning::AWSDriver::AWSProvider::AWSResource

Instance Attribute Summary

Attributes inherited from Chef::Provisioning::AWSDriver::AWSProvider

#purging

Instance Method Summary collapse

Methods inherited from Chef::Provisioning::AWSDriver::AWSProvider

#action_handler, #converge_by, #region, #whyrun_supported?

Instance Method Details

#create_aws_objectObject



6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/chef/provider/aws_cloudsearch_domain.rb', line 6

def create_aws_object
  domain = nil # define here to ensure it is available outside of the coverge_by scope
  converge_by "create CloudSearch domain #{new_resource.name}" do
    domain = create_domain
  end

  update_aws_object(domain)

  # TODO: since we don't support updating index fields yet,
  # it will not be handled by update_aws_object, so we need to
  # create the index fields here.
  create_index_fields
end

#destroy_aws_object(domain) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/chef/provider/aws_cloudsearch_domain.rb', line 20

def destroy_aws_object(domain)
  converge_by "delete CloudSearch domain #{new_resource.name}" do
    cs_client.delete_domain(domain_name: new_resource.name)
  end
  # CloudSearch can take over 30 minutes to delete so im not adding a waiter
  # for now
end

#update_aws_object(domain) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/chef/provider/aws_cloudsearch_domain.rb', line 28

def update_aws_object(domain)
  if update_availability_options?(domain)
    converge_by "update availability options for CloudSearch domain #{new_resource}" do
      update_availability_options
    end
  end

  if update_scaling_params?(domain)
    converge_by "update scaling parameters for CloudSearch domain #{new_resource.name}" do
      update_scaling_parameters
    end
  end

  if update_policy?(domain)
    converge_by "update access policy for CloudSearch domain #{new_resource.name}" do
      update_service_access_policy
    end
  end

  if update_index_fields?(domain)
    Chef::Log.warn("Updating existing index_fields not currently supported")
  end
end