Class: XClarityClient::ConfigPatternManagement

Inherits:
Services::XClarityService show all
Defined in:
lib/xclarity_client/services/config_pattern_management.rb

Instance Method Summary collapse

Methods inherited from Services::XClarityService

#fetch_all, #get_headers_with_opts, #get_object, #get_object_with_id, #get_object_with_opts, #initialize

Methods included from Services::ResponseBuilderMixin

#build_response_with_resource_list

Methods included from Services::ListNameInterpreterMixin

#add_listname_on_body

Constructor Details

This class inherits a constructor from XClarityClient::Services::XClarityService

Instance Method Details

#deploy_config_pattern(id, endpoints, restart, etype) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/xclarity_client/services/config_pattern_management.rb', line 20

def deploy_config_pattern(id,endpoints,restart,etype)
  if etype.eql? 'node'
    deployHash = {:uuid => endpoints}
  elsif etype.eql? 'rack' or etype.eql? 'tower'
    deployHash = {:endpointIds => endpoints}
  end
  deployHash.merge!({:restart => restart})
  response = @connection.do_post(managed_resource::BASE_URI + '/' +id, JSON.generate(deployHash))
  response

end

#export(id) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/xclarity_client/services/config_pattern_management.rb', line 7

def export(id)
  response = @connection.do_get(managed_resource::BASE_URI + "/" + id + "/includeSettings" )
  return [] unless response.success?

  body = JSON.parse(response.body)

  body = {managed_resource::LIST_NAME => body} if body.is_a? Array
  body = {managed_resource::LIST_NAME => [body]} unless body.has_key? managed_resource::LIST_NAME
  body[managed_resource::LIST_NAME].map do |resource_params|
    managed_resource.new resource_params
  end
end

#import_config_pattern(config_pattern) ⇒ Object



32
33
34
35
# File 'lib/xclarity_client/services/config_pattern_management.rb', line 32

def import_config_pattern(config_pattern)
  response = @connection.do_post(managed_resource::BASE_URI, config_pattern)
  response
end