Module: Chef::DSL::RestResource

Defined in:
lib/chef/dsl/rest_resource.rb

Instance Method Summary collapse

Instance Method Details

#rest_api_collection(rest_api_collection = NOT_PASSED) ⇒ Object

URL to collection


33
34
35
36
# File 'lib/chef/dsl/rest_resource.rb', line 33

def rest_api_collection(rest_api_collection = NOT_PASSED)
  @rest_api_collection = rest_api_collection if rest_api_collection != NOT_PASSED
  @rest_api_collection
end

#rest_api_document(rest_api_document = NOT_PASSED, first_element_only: false) ⇒ Object

RFC6570-Templated URL to document


39
40
41
42
43
44
45
# File 'lib/chef/dsl/rest_resource.rb', line 39

def rest_api_document(rest_api_document = NOT_PASSED, first_element_only: false)
  if rest_api_document != NOT_PASSED
    @rest_api_document = rest_api_document
    @rest_api_document_first_element_only = first_element_only
  end
  @rest_api_document
end

#rest_api_document_first_element_only(rest_api_document_first_element_only = NOT_PASSED) ⇒ Object


61
62
63
64
65
66
# File 'lib/chef/dsl/rest_resource.rb', line 61

def rest_api_document_first_element_only(rest_api_document_first_element_only = NOT_PASSED)
  if rest_api_document_first_element_only != NOT_PASSED
    @rest_api_document_first_element_only = rest_api_document_first_element_only
  end
  @rest_api_document_first_element_only
end

#rest_identity_map(rest_identity_map = NOT_PASSED) ⇒ Object

Explicit REST document identity mapping


48
49
50
51
# File 'lib/chef/dsl/rest_resource.rb', line 48

def rest_identity_map(rest_identity_map = NOT_PASSED)
  @rest_identity_map = rest_identity_map if rest_identity_map != NOT_PASSED
  @rest_identity_map
end

#rest_post_only_properties(rest_post_only_properties = NOT_PASSED) ⇒ Object

Mark up properties for POST only, not PATCH/PUT


54
55
56
57
58
59
# File 'lib/chef/dsl/rest_resource.rb', line 54

def rest_post_only_properties(rest_post_only_properties = NOT_PASSED)
  if rest_post_only_properties != NOT_PASSED
    @rest_post_only_properties = Array(rest_post_only_properties).map(&:to_sym)
  end
  @rest_post_only_properties || []
end

#rest_property_map(rest_property_map = NOT_PASSED) ⇒ Object


23
24
25
26
27
28
29
30
# File 'lib/chef/dsl/rest_resource.rb', line 23

def rest_property_map(rest_property_map = NOT_PASSED)
  if rest_property_map != NOT_PASSED
    rest_property_map = rest_property_map.to_h { |k| [k.to_sym, k] } if rest_property_map.is_a? Array

    @rest_property_map = rest_property_map
  end
  @rest_property_map
end