=begin #Datadog API V1 Collection #Collection of all Datadog Public endpoints. The version of the OpenAPI document: 1.0 Contact: support@datadoghq.com Generated by: https://openapi-generator.tech Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020-Present Datadog, Inc. =end require 'cgi' module DatadogAPIClient::V1 class OrganizationsAPI attr_accessor :api_client def initialize(api_client = APIClient.default) @api_client = api_client end # Create a child organization # Create a child organization. This endpoint requires the [multi-organization account](https://docs.datadoghq.com/account_management/multi_organization/) feature and must be enabled by [contacting support](https://docs.datadoghq.com/help/). Once a new child organization is created, you can interact with it by using the `org.public_id`, `api_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] def create_child_org(body, opts = {}) data, _status_code, _headers = create_child_org_with_http_info(body, opts) data end # Create a child organization # Create a child organization. This endpoint requires the [multi-organization account](https://docs.datadoghq.com/account_management/multi_organization/) feature and must be enabled by [contacting support](https://docs.datadoghq.com/help/). Once a new child organization is created, you can interact with it by using the `org.public_id`, `api_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 [Array<(OrganizationCreateResponse, Integer, Hash)>] OrganizationCreateResponse data, response status code and response headers 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 organization information # Get organization information. # @param public_id [String] The `public_id` of the organization you are operating within. # @param [Hash] opts the optional parameters # @return [OrganizationResponse] def get_org(public_id, opts = {}) data, _status_code, _headers = get_org_with_http_info(public_id, opts) data end # Get organization information # Get organization information. # @param public_id [String] The `public_id` 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 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 your managed organizations # List your managed organizations. # @param [Hash] opts the optional parameters # @return [OrganizationListResponse] def list_orgs(opts = {}) data, _status_code, _headers = list_orgs_with_http_info(opts) data end # 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 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 your organization # Update your organization. # @param public_id [String] The `public_id` of the organization you are operating within. # @param body [Organization] # @param [Hash] opts the optional parameters # @return [OrganizationResponse] def update_org(public_id, body, opts = {}) data, _status_code, _headers = update_org_with_http_info(public_id, body, opts) data end # Update your organization # Update your organization. # @param public_id [String] The `public_id` 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 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 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 `public_id` 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] 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 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 `public_id` 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 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 end end