class DatadogAPIClient::V1::OrganizationsAPI

Attributes

api_client[RW]

Public Class Methods

new(api_client = APIClient.default) click to toggle source
# File lib/datadog_api_client/v1/api/organizations_api.rb, line 22
def initialize(api_client = APIClient.default)
  @api_client = api_client
end

Public Instance Methods

create_child_org(body, opts = {}) click to toggle source

Create a child organization Create a child organization. This endpoint requires the [multi-organization account](docs.datadoghq.com/account_management/multi_organization/) feature and must be enabled by [contacting support](docs.datadoghq.com/help/). Once a new child organization is created, you can interact with it by using the `org.public_id`, `pi_key.key`, and `application_key.hash` provided in the response. @param body [OrganizationCreateBody] Organization object that needs to be created @param [Hash] opts the optional parameters @return [OrganizationCreateResponse]

# File lib/datadog_api_client/v1/api/organizations_api.rb, line 30
def create_child_org(body, opts = {})
  data, _status_code, _headers = create_child_org_with_http_info(body, opts)
  data
end
create_child_org_with_http_info(body, opts = {}) click to toggle source

Create a child organization Create a child organization. This endpoint requires the [multi-organization account](docs.datadoghq.com/account_management/multi_organization/) feature and must be enabled by [contacting support](docs.datadoghq.com/help/). Once a new child organization is created, you can interact with it by using the &#x60;org.public_id&#x60;, &#x60;pi_key.key&#x60;, and &#x60;application_key.hash&#x60; provided in the response. @param body [OrganizationCreateBody] Organization object that needs to be created @param [Hash] opts the optional parameters @return [Array<(OrganizationCreateResponse, Integer, Hash)>] OrganizationCreateResponse data, response status code and response headers

# File lib/datadog_api_client/v1/api/organizations_api.rb, line 40
def create_child_org_with_http_info(body, opts = {})

  if @api_client.config.unstable_operations.has_key?(:create_child_org)
    unstable_enabled = @api_client.config.unstable_operations[:create_child_org]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "create_child_org")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "create_child_org"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsAPI.create_child_org ...'
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling OrganizationsAPI.create_child_org"
  end
  # resource path
  local_var_path = '/api/v1/org'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationCreateResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

  new_options = opts.merge(
    :operation => :create_child_org,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationsAPI#create_child_org\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_org(public_id, opts = {}) click to toggle source

Get organization information Get organization information. @param public_id [String] The &#x60;public_id&#x60; of the organization you are operating within. @param [Hash] opts the optional parameters @return [OrganizationResponse]

# File lib/datadog_api_client/v1/api/organizations_api.rb, line 105
def get_org(public_id, opts = {})
  data, _status_code, _headers = get_org_with_http_info(public_id, opts)
  data
end
get_org_with_http_info(public_id, opts = {}) click to toggle source

Get organization information Get organization information. @param public_id [String] The &#x60;public_id&#x60; of the organization you are operating within. @param [Hash] opts the optional parameters @return [Array<(OrganizationResponse, Integer, Hash)>] OrganizationResponse data, response status code and response headers

# File lib/datadog_api_client/v1/api/organizations_api.rb, line 115
def get_org_with_http_info(public_id, opts = {})

  if @api_client.config.unstable_operations.has_key?(:get_org)
    unstable_enabled = @api_client.config.unstable_operations[:get_org]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "get_org")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "get_org"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsAPI.get_org ...'
  end
  # verify the required parameter 'public_id' is set
  if @api_client.config.client_side_validation && public_id.nil?
    fail ArgumentError, "Missing the required parameter 'public_id' when calling OrganizationsAPI.get_org"
  end
  # resource path
  local_var_path = '/api/v1/org/{public_id}'.sub('{' + 'public_id' + '}', CGI.escape(public_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

  new_options = opts.merge(
    :operation => :get_org,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationsAPI#get_org\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
list_orgs(opts = {}) click to toggle source

List your managed organizations List your managed organizations. @param [Hash] opts the optional parameters @return [OrganizationListResponse]

# File lib/datadog_api_client/v1/api/organizations_api.rb, line 177
def list_orgs(opts = {})
  data, _status_code, _headers = list_orgs_with_http_info(opts)
  data
end
list_orgs_with_http_info(opts = {}) click to toggle source

List your managed organizations List your managed organizations. @param [Hash] opts the optional parameters @return [Array<(OrganizationListResponse, Integer, Hash)>] OrganizationListResponse data, response status code and response headers

# File lib/datadog_api_client/v1/api/organizations_api.rb, line 186
def list_orgs_with_http_info(opts = {})

  if @api_client.config.unstable_operations.has_key?(:list_orgs)
    unstable_enabled = @api_client.config.unstable_operations[:list_orgs]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "list_orgs")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "list_orgs"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsAPI.list_orgs ...'
  end
  # resource path
  local_var_path = '/api/v1/org'

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationListResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

  new_options = opts.merge(
    :operation => :list_orgs,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationsAPI#list_orgs\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
update_org(public_id, body, opts = {}) click to toggle source

Update your organization Update your organization. @param public_id [String] The &#x60;public_id&#x60; of the organization you are operating within. @param body [Organization] @param [Hash] opts the optional parameters @return [OrganizationResponse]

# File lib/datadog_api_client/v1/api/organizations_api.rb, line 246
def update_org(public_id, body, opts = {})
  data, _status_code, _headers = update_org_with_http_info(public_id, body, opts)
  data
end
update_org_with_http_info(public_id, body, opts = {}) click to toggle source

Update your organization Update your organization. @param public_id [String] The &#x60;public_id&#x60; of the organization you are operating within. @param body [Organization] @param [Hash] opts the optional parameters @return [Array<(OrganizationResponse, Integer, Hash)>] OrganizationResponse data, response status code and response headers

# File lib/datadog_api_client/v1/api/organizations_api.rb, line 257
def update_org_with_http_info(public_id, body, opts = {})

  if @api_client.config.unstable_operations.has_key?(:update_org)
    unstable_enabled = @api_client.config.unstable_operations[:update_org]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "update_org")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "update_org"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsAPI.update_org ...'
  end
  # verify the required parameter 'public_id' is set
  if @api_client.config.client_side_validation && public_id.nil?
    fail ArgumentError, "Missing the required parameter 'public_id' when calling OrganizationsAPI.update_org"
  end
  # verify the required parameter 'body' is set
  if @api_client.config.client_side_validation && body.nil?
    fail ArgumentError, "Missing the required parameter 'body' when calling OrganizationsAPI.update_org"
  end
  # resource path
  local_var_path = '/api/v1/org/{public_id}'.sub('{' + 'public_id' + '}', CGI.escape(public_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:debug_body] || @api_client.object_to_http_body(body)

  # return_type
  return_type = opts[:debug_return_type] || 'OrganizationResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

  new_options = opts.merge(
    :operation => :update_org,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationsAPI#update_org\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
upload_id_p_for_org(public_id, idp_file, opts = {}) click to toggle source

Upload IdP metadata There are a couple of options for updating the Identity Provider (IdP) metadata from your SAML IdP. * **Multipart Form-Data**: Post the IdP metadata file using a form post. * **XML Body:** Post the IdP metadata file as the body of the request. @param public_id [String] The &#x60;public_id&#x60; of the organization you are operating with @param idp_file [File] The path to the XML metadata file you wish to upload. @param [Hash] opts the optional parameters @return [IdpResponse]

# File lib/datadog_api_client/v1/api/organizations_api.rb, line 327
def upload_id_p_for_org(public_id, idp_file, opts = {})
  data, _status_code, _headers = upload_id_p_for_org_with_http_info(public_id, idp_file, opts)
  data
end
upload_id_p_for_org_with_http_info(public_id, idp_file, opts = {}) click to toggle source

Upload IdP metadata There are a couple of options for updating the Identity Provider (IdP) metadata from your SAML IdP. * **Multipart Form-Data**: Post the IdP metadata file using a form post. * **XML Body:** Post the IdP metadata file as the body of the request. @param public_id [String] The &#x60;public_id&#x60; of the organization you are operating with @param idp_file [File] The path to the XML metadata file you wish to upload. @param [Hash] opts the optional parameters @return [Array<(IdpResponse, Integer, Hash)>] IdpResponse data, response status code and response headers

# File lib/datadog_api_client/v1/api/organizations_api.rb, line 338
def upload_id_p_for_org_with_http_info(public_id, idp_file, opts = {})

  if @api_client.config.unstable_operations.has_key?(:upload_id_p_for_org)
    unstable_enabled = @api_client.config.unstable_operations[:upload_id_p_for_org]
    if unstable_enabled
      @api_client.config.logger.warn format("Using unstable operation '%s'", "upload_id_p_for_org")
    else
      raise APIError.new(message: format("Unstable operation '%s' is disabled", "upload_id_p_for_org"))
    end
  end

  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: OrganizationsAPI.upload_id_p_for_org ...'
  end
  # verify the required parameter 'public_id' is set
  if @api_client.config.client_side_validation && public_id.nil?
    fail ArgumentError, "Missing the required parameter 'public_id' when calling OrganizationsAPI.upload_id_p_for_org"
  end
  # verify the required parameter 'idp_file' is set
  if @api_client.config.client_side_validation && idp_file.nil?
    fail ArgumentError, "Missing the required parameter 'idp_file' when calling OrganizationsAPI.upload_id_p_for_org"
  end
  # resource path
  local_var_path = '/api/v1/org/{public_id}/idp_metadata'.sub('{' + 'public_id' + '}', CGI.escape(public_id.to_s))

  # query parameters
  query_params = opts[:query_params] || {}

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data'])

  # form parameters
  form_params = opts[:form_params] || {}
  form_params['idp_file'] = idp_file

  # http body (model)
  post_body = opts[:debug_body]

  # return_type
  return_type = opts[:debug_return_type] || 'IdpResponse'

  # auth_names
  auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]

  new_options = opts.merge(
    :operation => :upload_id_p_for_org,
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: OrganizationsAPI#upload_id_p_for_org\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end