class LaunchDarklyApi::CustomRolesApi

Attributes

api_client[RW]

Public Class Methods

new(api_client = ApiClient.default) click to toggle source
# File lib/launchdarkly_api/api/custom_roles_api.rb, line 19
def initialize(api_client = ApiClient.default)
  @api_client = api_client
end

Public Instance Methods

delete_custom_role(key, opts = {}) click to toggle source

Delete custom role Delete a custom role by key @param key [String] The key of the custom role to delete @param [Hash] opts the optional parameters @return [nil]

# File lib/launchdarkly_api/api/custom_roles_api.rb, line 27
def delete_custom_role(key, opts = {})
  delete_custom_role_with_http_info(key, opts)
  nil
end
delete_custom_role_with_http_info(key, opts = {}) click to toggle source

Delete custom role Delete a custom role by key @param key [String] The key of the custom role to delete @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers

# File lib/launchdarkly_api/api/custom_roles_api.rb, line 37
def delete_custom_role_with_http_info(key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomRolesApi.delete_custom_role ...'
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling CustomRolesApi.delete_custom_role"
  end
  # resource path
  local_var_path = '/api/v2/roles/{key}'.sub('{' + 'key' + '}', CGI.escape(key.to_s))

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

  # header parameters
  header_params = opts[:header_params] || {}

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

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

  # return_type
  return_type = opts[:debug_return_type]

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"CustomRolesApi.delete_custom_role",
    :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(:DELETE, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomRolesApi#delete_custom_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_custom_role(key, opts = {}) click to toggle source

Get custom role Get a single custom role by key or ID @param key [String] The custom role&#39;s key or ID @param [Hash] opts the optional parameters @return [CustomRolePost]

# File lib/launchdarkly_api/api/custom_roles_api.rb, line 88
def get_custom_role(key, opts = {})
  data, _status_code, _headers = get_custom_role_with_http_info(key, opts)
  data
end
get_custom_role_with_http_info(key, opts = {}) click to toggle source

Get custom role Get a single custom role by key or ID @param key [String] The custom role&#39;s key or ID @param [Hash] opts the optional parameters @return [Array<(CustomRolePost, Integer, Hash)>] CustomRolePost data, response status code and response headers

# File lib/launchdarkly_api/api/custom_roles_api.rb, line 98
def get_custom_role_with_http_info(key, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomRolesApi.get_custom_role ...'
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling CustomRolesApi.get_custom_role"
  end
  # resource path
  local_var_path = '/api/v2/roles/{key}'.sub('{' + 'key' + '}', CGI.escape(key.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] || 'CustomRolePost'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"CustomRolesApi.get_custom_role",
    :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: CustomRolesApi#get_custom_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
get_custom_roles(opts = {}) click to toggle source

List custom roles Get a complete list of custom roles. Custom roles let you create flexible policies providing fine-grained access control to everything in LaunchDarkly, from feature flags to goals, environments, and teams. With custom roles, it's possible to enforce access policies that meet your exact workflow needs. Custom roles are available to customers on our enterprise plans. If you're interested in learning more about our enterprise plans, contact sales@launchdarkly.com. @param [Hash] opts the optional parameters @return [CustomRoles]

# File lib/launchdarkly_api/api/custom_roles_api.rb, line 150
def get_custom_roles(opts = {})
  data, _status_code, _headers = get_custom_roles_with_http_info(opts)
  data
end
get_custom_roles_with_http_info(opts = {}) click to toggle source

List custom roles Get a complete list of custom roles. Custom roles let you create flexible policies providing fine-grained access control to everything in LaunchDarkly, from feature flags to goals, environments, and teams. With custom roles, it&#39;s possible to enforce access policies that meet your exact workflow needs. Custom roles are available to customers on our enterprise plans. If you&#39;re interested in learning more about our enterprise plans, contact sales@launchdarkly.com. @param [Hash] opts the optional parameters @return [Array<(CustomRoles, Integer, Hash)>] CustomRoles data, response status code and response headers

# File lib/launchdarkly_api/api/custom_roles_api.rb, line 159
def get_custom_roles_with_http_info(opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomRolesApi.get_custom_roles ...'
  end
  # resource path
  local_var_path = '/api/v2/roles'

  # 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] || 'CustomRoles'

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"CustomRolesApi.get_custom_roles",
    :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: CustomRolesApi#get_custom_roles\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
patch_custom_role(key, patch_with_comment, opts = {}) click to toggle source

Update custom role Update a single custom role. The request must be a valid JSON Patch document describing the changes to be made to the custom role. @param key [String] The key of the custom role to update @param patch_with_comment [PatchWithComment] @param [Hash] opts the optional parameters @return [CustomRole]

# File lib/launchdarkly_api/api/custom_roles_api.rb, line 209
def patch_custom_role(key, patch_with_comment, opts = {})
  data, _status_code, _headers = patch_custom_role_with_http_info(key, patch_with_comment, opts)
  data
end
patch_custom_role_with_http_info(key, patch_with_comment, opts = {}) click to toggle source

Update custom role Update a single custom role. The request must be a valid JSON Patch document describing the changes to be made to the custom role. @param key [String] The key of the custom role to update @param patch_with_comment [PatchWithComment] @param [Hash] opts the optional parameters @return [Array<(CustomRole, Integer, Hash)>] CustomRole data, response status code and response headers

# File lib/launchdarkly_api/api/custom_roles_api.rb, line 220
def patch_custom_role_with_http_info(key, patch_with_comment, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomRolesApi.patch_custom_role ...'
  end
  # verify the required parameter 'key' is set
  if @api_client.config.client_side_validation && key.nil?
    fail ArgumentError, "Missing the required parameter 'key' when calling CustomRolesApi.patch_custom_role"
  end
  # verify the required parameter 'patch_with_comment' is set
  if @api_client.config.client_side_validation && patch_with_comment.nil?
    fail ArgumentError, "Missing the required parameter 'patch_with_comment' when calling CustomRolesApi.patch_custom_role"
  end
  # resource path
  local_var_path = '/api/v2/roles/{key}'.sub('{' + 'key' + '}', CGI.escape(key.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(patch_with_comment)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"CustomRolesApi.patch_custom_role",
    :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(:PATCH, local_var_path, new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: CustomRolesApi#patch_custom_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end
post_custom_role(statement_post, opts = {}) click to toggle source

Create custom role Create a new custom role @param statement_post [Array<StatementPost>] @param [Hash] opts the optional parameters @return [CustomRole]

# File lib/launchdarkly_api/api/custom_roles_api.rb, line 279
def post_custom_role(statement_post, opts = {})
  data, _status_code, _headers = post_custom_role_with_http_info(statement_post, opts)
  data
end
post_custom_role_with_http_info(statement_post, opts = {}) click to toggle source

Create custom role Create a new custom role @param statement_post [Array<StatementPost>] @param [Hash] opts the optional parameters @return [Array<(CustomRole, Integer, Hash)>] CustomRole data, response status code and response headers

# File lib/launchdarkly_api/api/custom_roles_api.rb, line 289
def post_custom_role_with_http_info(statement_post, opts = {})
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: CustomRolesApi.post_custom_role ...'
  end
  # verify the required parameter 'statement_post' is set
  if @api_client.config.client_side_validation && statement_post.nil?
    fail ArgumentError, "Missing the required parameter 'statement_post' when calling CustomRolesApi.post_custom_role"
  end
  # resource path
  local_var_path = '/api/v2/roles'

  # 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(statement_post)

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

  # auth_names
  auth_names = opts[:debug_auth_names] || ['ApiKey']

  new_options = opts.merge(
    :operation => :"CustomRolesApi.post_custom_role",
    :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: CustomRolesApi#post_custom_role\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end