class LaunchDarklyApi::EnvironmentsApi
Attributes
Public Class Methods
# File lib/launchdarkly_api/api/environments_api.rb, line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end
Public Instance Methods
Delete environment Delete a environment by key. @param project_key [String] The project key @param environment_key [String] The environment key @param [Hash] opts the optional parameters @return [nil]
# File lib/launchdarkly_api/api/environments_api.rb, line 28 def delete_environment(project_key, environment_key, opts = {}) delete_environment_with_http_info(project_key, environment_key, opts) nil end
Delete environment Delete a environment by key. @param project_key [String] The project key @param environment_key [String] The environment key @param [Hash] opts the optional parameters @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
# File lib/launchdarkly_api/api/environments_api.rb, line 39 def delete_environment_with_http_info(project_key, environment_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EnvironmentsApi.delete_environment ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentsApi.delete_environment" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling EnvironmentsApi.delete_environment" end # resource path local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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 => :"EnvironmentsApi.delete_environment", :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: EnvironmentsApi#delete_environment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Get environment > ### Approval settings > > The `approvalSettings` key is only returned when the Flag Approvals feature is enabled. Get an environment given a project and key. @param project_key [String] The project key @param environment_key [String] The environment key @param [Hash] opts the optional parameters @return [Environment]
# File lib/launchdarkly_api/api/environments_api.rb, line 95 def get_environment(project_key, environment_key, opts = {}) data, _status_code, _headers = get_environment_with_http_info(project_key, environment_key, opts) data end
Get environment > ### Approval settings > > The `approvalSettings` key is only returned when the Flag Approvals feature is enabled. Get an environment given a project and key. @param project_key [String] The project key @param environment_key [String] The environment key @param [Hash] opts the optional parameters @return [Array<(Environment
, Integer, Hash)>] Environment
data, response status code and response headers
# File lib/launchdarkly_api/api/environments_api.rb, line 106 def get_environment_with_http_info(project_key, environment_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EnvironmentsApi.get_environment ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentsApi.get_environment" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling EnvironmentsApi.get_environment" end # resource path local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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] || 'Environment' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] new_options = opts.merge( :operation => :"EnvironmentsApi.get_environment", :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: EnvironmentsApi#get_environment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Update environment > ### Approval settings > > The `approvalSettings` key is only returned when the Flag Approvals feature is enabled. > > Only the `canReviewOwnRequest`, `canApplyDeclinedChanges`, `minNumApprovals`, `required` and `requiredApprovalTagsfields` are editable. > > If you try to patch the environment by setting both `required` and `requiredApprovalTags`, it fails and an error appears. Users
can specify either required approvals for all flags in an environment or those with specific tags, but not both. Only customers on an Enterprise plan can require approval for flag updates by either mechanism. @param project_key [String] The project key @param environment_key [String] The environment key @param patch_operation [Array<PatchOperation>] @param [Hash] opts the optional parameters @return [Environment]
# File lib/launchdarkly_api/api/environments_api.rb, line 165 def patch_environment(project_key, environment_key, patch_operation, opts = {}) data, _status_code, _headers = patch_environment_with_http_info(project_key, environment_key, patch_operation, opts) data end
Update environment > ### Approval settings > > The `approvalSettings` key is only returned when the Flag Approvals feature is enabled. > > Only the `canReviewOwnRequest`, `canApplyDeclinedChanges`, `minNumApprovals`, `required` and `requiredApprovalTagsfields` are editable. > > If you try to patch the environment by setting both `required` and `requiredApprovalTags`, it fails and an error appears. Users
can specify either required approvals for all flags in an environment or those with specific tags, but not both. Only customers on an Enterprise plan can require approval for flag updates by either mechanism. @param project_key [String] The project key @param environment_key [String] The environment key @param patch_operation [Array<PatchOperation>] @param [Hash] opts the optional parameters @return [Array<(Environment
, Integer, Hash)>] Environment
data, response status code and response headers
# File lib/launchdarkly_api/api/environments_api.rb, line 177 def patch_environment_with_http_info(project_key, environment_key, patch_operation, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EnvironmentsApi.patch_environment ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentsApi.patch_environment" end # verify the required parameter 'environment_key' is set if @api_client.config.client_side_validation && environment_key.nil? fail ArgumentError, "Missing the required parameter 'environment_key' when calling EnvironmentsApi.patch_environment" end # verify the required parameter 'patch_operation' is set if @api_client.config.client_side_validation && patch_operation.nil? fail ArgumentError, "Missing the required parameter 'patch_operation' when calling EnvironmentsApi.patch_environment" end # resource path local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_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_operation) # return_type return_type = opts[:debug_return_type] || 'Environment' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] new_options = opts.merge( :operation => :"EnvironmentsApi.patch_environment", :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: EnvironmentsApi#patch_environment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Create environment > ### Approval settings > > The `approvalSettings` key is only returned when the Flag Approvals feature is enabled. Create a new environment in a specified project with a given name, key, swatch color, and default TTL. @param project_key [String] The project key @param environment_post [EnvironmentPost] @param [Hash] opts the optional parameters @return [Environment]
# File lib/launchdarkly_api/api/environments_api.rb, line 241 def post_environment(project_key, environment_post, opts = {}) data, _status_code, _headers = post_environment_with_http_info(project_key, environment_post, opts) data end
Create environment > ### Approval settings > > The `approvalSettings` key is only returned when the Flag Approvals feature is enabled. Create a new environment in a specified project with a given name, key, swatch color, and default TTL. @param project_key [String] The project key @param environment_post [EnvironmentPost] @param [Hash] opts the optional parameters @return [Array<(Environment
, Integer, Hash)>] Environment
data, response status code and response headers
# File lib/launchdarkly_api/api/environments_api.rb, line 252 def post_environment_with_http_info(project_key, environment_post, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EnvironmentsApi.post_environment ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentsApi.post_environment" end # verify the required parameter 'environment_post' is set if @api_client.config.client_side_validation && environment_post.nil? fail ArgumentError, "Missing the required parameter 'environment_post' when calling EnvironmentsApi.post_environment" end # resource path local_var_path = '/api/v2/projects/{projectKey}/environments'.sub('{' + 'projectKey' + '}', CGI.escape(project_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(environment_post) # return_type return_type = opts[:debug_return_type] || 'Environment' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] new_options = opts.merge( :operation => :"EnvironmentsApi.post_environment", :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: EnvironmentsApi#post_environment\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Reset environment mobile SDK key Reset an environment's mobile key. The optional expiry for the old key is deprecated for this endpoint, so the old key will always expire immediately. @param project_key [String] The project key @param env_key [String] The environment key @param [Hash] opts the optional parameters @return [Environment]
# File lib/launchdarkly_api/api/environments_api.rb, line 312 def reset_environment_mobile_key(project_key, env_key, opts = {}) data, _status_code, _headers = reset_environment_mobile_key_with_http_info(project_key, env_key, opts) data end
Reset environment mobile SDK key Reset an environment's mobile key. The optional expiry for the old key is deprecated for this endpoint, so the old key will always expire immediately. @param project_key [String] The project key @param env_key [String] The environment key @param [Hash] opts the optional parameters @return [Array<(Environment
, Integer, Hash)>] Environment
data, response status code and response headers
# File lib/launchdarkly_api/api/environments_api.rb, line 323 def reset_environment_mobile_key_with_http_info(project_key, env_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EnvironmentsApi.reset_environment_mobile_key ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentsApi.reset_environment_mobile_key" end # verify the required parameter 'env_key' is set if @api_client.config.client_side_validation && env_key.nil? fail ArgumentError, "Missing the required parameter 'env_key' when calling EnvironmentsApi.reset_environment_mobile_key" end # resource path local_var_path = '/api/v2/projects/{projectKey}/environments/{envKey}/mobileKey'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'envKey' + '}', CGI.escape(env_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] || 'Environment' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] new_options = opts.merge( :operation => :"EnvironmentsApi.reset_environment_mobile_key", :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: EnvironmentsApi#reset_environment_mobile_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
Reset environment SDK key Reset an environment's SDK key with an optional expiry time for the old key. @param project_key [String] The project key @param env_key [String] The environment key @param [Hash] opts the optional parameters @option opts [Integer] :expiry The time at which you want the old SDK key to expire, in UNIX milliseconds. By default, the key expires immediately. @return [Environment]
# File lib/launchdarkly_api/api/environments_api.rb, line 382 def reset_environment_sdk_key(project_key, env_key, opts = {}) data, _status_code, _headers = reset_environment_sdk_key_with_http_info(project_key, env_key, opts) data end
Reset environment SDK key Reset an environment's SDK key with an optional expiry time for the old key. @param project_key [String] The project key @param env_key [String] The environment key @param [Hash] opts the optional parameters @option opts [Integer] :expiry The time at which you want the old SDK key to expire, in UNIX milliseconds. By default, the key expires immediately. @return [Array<(Environment
, Integer, Hash)>] Environment
data, response status code and response headers
# File lib/launchdarkly_api/api/environments_api.rb, line 394 def reset_environment_sdk_key_with_http_info(project_key, env_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: EnvironmentsApi.reset_environment_sdk_key ...' end # verify the required parameter 'project_key' is set if @api_client.config.client_side_validation && project_key.nil? fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentsApi.reset_environment_sdk_key" end # verify the required parameter 'env_key' is set if @api_client.config.client_side_validation && env_key.nil? fail ArgumentError, "Missing the required parameter 'env_key' when calling EnvironmentsApi.reset_environment_sdk_key" end # resource path local_var_path = '/api/v2/projects/{projectKey}/environments/{envKey}/apiKey'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'envKey' + '}', CGI.escape(env_key.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'expiry'] = opts[:'expiry'] if !opts[:'expiry'].nil? # 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] || 'Environment' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] new_options = opts.merge( :operation => :"EnvironmentsApi.reset_environment_sdk_key", :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: EnvironmentsApi#reset_environment_sdk_key\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end