module Chef::DSL::RestResource

Public Instance Methods

rest_api_collection(rest_api_collection = NOT_PASSED) click to toggle source

URL to collection

# File lib/chef/dsl/rest_resource.rb, line 33
def rest_api_collection(rest_api_collection = NOT_PASSED)
  if rest_api_collection != NOT_PASSED
    raise ArgumentError, "You must pass an absolute path to rest_api_collection" unless rest_api_collection.start_with? "/"

    @rest_api_collection = rest_api_collection
  end

  @rest_api_collection
end
rest_api_document(rest_api_document = NOT_PASSED, first_element_only: false) click to toggle source

RFC6570-Templated URL to document

# File lib/chef/dsl/rest_resource.rb, line 44
def rest_api_document(rest_api_document = NOT_PASSED, first_element_only: false)
  if rest_api_document != NOT_PASSED
    raise ArgumentError, "You must pass an absolute path to rest_api_document" unless rest_api_document.start_with? "/"

    @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) click to toggle source
# File lib/chef/dsl/rest_resource.rb, line 68
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) click to toggle source

Explicit REST document identity mapping

# File lib/chef/dsl/rest_resource.rb, line 55
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) click to toggle source

Mark up properties for POST only, not PATCH/PUT

# File lib/chef/dsl/rest_resource.rb, line 61
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) click to toggle source
# 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