Class: LaunchDarklyApi::LayersApi
- Inherits:
-
Object
- Object
- LaunchDarklyApi::LayersApi
- Defined in:
- lib/launchdarkly_api/api/layers_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#create_layer(project_key, layer_post, opts = {}) ⇒ LayerRep
Create layer Create a layer.
-
#create_layer_with_http_info(project_key, layer_post, opts = {}) ⇒ Array<(LayerRep, Integer, Hash)>
Create layer Create a layer.
-
#get_layers(project_key, opts = {}) ⇒ LayerCollectionRep
Get layers Get a collection of all layers for a project.
-
#get_layers_with_http_info(project_key, opts = {}) ⇒ Array<(LayerCollectionRep, Integer, Hash)>
Get layers Get a collection of all layers for a project.
-
#initialize(api_client = ApiClient.default) ⇒ LayersApi
constructor
A new instance of LayersApi.
-
#update_layer(project_key, layer_key, layer_patch_input, opts = {}) ⇒ LayerRep
Update layer Update a layer by adding, changing, or removing traffic reservations for experiments, or by changing layer name or description.
-
#update_layer_with_http_info(project_key, layer_key, layer_patch_input, opts = {}) ⇒ Array<(LayerRep, Integer, Hash)>
Update layer Update a layer by adding, changing, or removing traffic reservations for experiments, or by changing layer name or description.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/launchdarkly_api/api/layers_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#create_layer(project_key, layer_post, opts = {}) ⇒ LayerRep
Create layer Create a layer. Experiments running in the same layer are granted mutually-exclusive traffic.
28 29 30 31 |
# File 'lib/launchdarkly_api/api/layers_api.rb', line 28 def create_layer(project_key, layer_post, opts = {}) data, _status_code, _headers = create_layer_with_http_info(project_key, layer_post, opts) data end |
#create_layer_with_http_info(project_key, layer_post, opts = {}) ⇒ Array<(LayerRep, Integer, Hash)>
Create layer Create a layer. Experiments running in the same layer are granted mutually-exclusive traffic.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 |
# File 'lib/launchdarkly_api/api/layers_api.rb', line 39 def create_layer_with_http_info(project_key, layer_post, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LayersApi.create_layer ...' 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 LayersApi.create_layer" end # verify the required parameter 'layer_post' is set if @api_client.config.client_side_validation && layer_post.nil? fail ArgumentError, "Missing the required parameter 'layer_post' when calling LayersApi.create_layer" end # resource path local_var_path = '/api/v2/projects/{projectKey}/layers'.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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(layer_post) # return_type return_type = opts[:debug_return_type] || 'LayerRep' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"LayersApi.create_layer", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LayersApi#create_layer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#get_layers(project_key, opts = {}) ⇒ LayerCollectionRep
Get layers Get a collection of all layers for a project
102 103 104 105 |
# File 'lib/launchdarkly_api/api/layers_api.rb', line 102 def get_layers(project_key, opts = {}) data, _status_code, _headers = get_layers_with_http_info(project_key, opts) data end |
#get_layers_with_http_info(project_key, opts = {}) ⇒ Array<(LayerCollectionRep, Integer, Hash)>
Get layers Get a collection of all layers for a project
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
# File 'lib/launchdarkly_api/api/layers_api.rb', line 113 def get_layers_with_http_info(project_key, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LayersApi.get_layers ...' 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 LayersApi.get_layers" end # resource path local_var_path = '/api/v2/projects/{projectKey}/layers'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)) # query parameters query_params = opts[:query_params] || {} query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].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] || 'LayerCollectionRep' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"LayersApi.get_layers", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LayersApi#get_layers\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#update_layer(project_key, layer_key, layer_patch_input, opts = {}) ⇒ LayerRep
Update layer Update a layer by adding, changing, or removing traffic reservations for experiments, or by changing layer name or description. Updating a layer uses the semantic patch format. To make a semantic patch request, you must append ‘domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](launchdarkly.com/docs/api#updates-using-semantic-patch). ### Instructions Semantic patch requests support the following `kind` instructions for updating layers. <details> <summary>Click to expand instructions for <strong>updating layers</strong></summary> #### updateName Updates the layer name. ##### Parameters - `name`: The new layer name. Here’s an example: “‘json { "instructions": [{ "kind": "updateName", "name": "New name" }] } “` #### updateDescription Updates the layer description. ##### Parameters - `description`: The new description. Here’s an example: “‘json { "instructions": [{ "kind": "updateDescription", "description": "New description" }] } “` #### updateExperimentReservation Adds or updates a traffic reservation for an experiment in a layer. ##### Parameters - `experimentKey`: The key of the experiment whose reservation you are adding to or updating in the layer. - `reservationPercent`: The amount of traffic in the layer to reserve. Must be an integer. Zero is allowed until iteration start. Here’s an example: “‘json { "environmentKey": "production", "instructions": [{ "kind": "updateExperimentReservation", "experimentKey": "exp-key", "reservationPercent": 10 }] } “` #### removeExperiment Removes a traffic reservation for an experiment from a layer. ##### Parameters - `experimentKey`: The key of the experiment whose reservation you want to remove from the layer. Here’s an example: “‘json { "environmentKey": "production", "instructions": [{ "kind": "removeExperiment", "experimentKey": "exp-key" }] } “` </details>
169 170 171 172 |
# File 'lib/launchdarkly_api/api/layers_api.rb', line 169 def update_layer(project_key, layer_key, layer_patch_input, opts = {}) data, _status_code, _headers = update_layer_with_http_info(project_key, layer_key, layer_patch_input, opts) data end |
#update_layer_with_http_info(project_key, layer_key, layer_patch_input, opts = {}) ⇒ Array<(LayerRep, Integer, Hash)>
Update layer Update a layer by adding, changing, or removing traffic reservations for experiments, or by changing layer name or description. Updating a layer uses the semantic patch format. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. To learn more, read [Updates using semantic patch](launchdarkly.com/docs/api#updates-using-semantic-patch). ### Instructions Semantic patch requests support the following `kind` instructions for updating layers. <details> <summary>Click to expand instructions for <strong>updating layers</strong></summary> #### updateName Updates the layer name. ##### Parameters - `name`: The new layer name. Here's an example: ```json { "instructions": [{ "kind": "updateName", "name": "New name" }] } ``` #### updateDescription Updates the layer description. ##### Parameters - `description`: The new description. Here's an example: ```json { "instructions": [{ "kind": "updateDescription", "description": "New description" }] } ``` #### updateExperimentReservation Adds or updates a traffic reservation for an experiment in a layer. ##### Parameters - `experimentKey`: The key of the experiment whose reservation you are adding to or updating in the layer. - `reservationPercent`: The amount of traffic in the layer to reserve. Must be an integer. Zero is allowed until iteration start. Here's an example: ```json { "environmentKey": "production", "instructions": [{ "kind": "updateExperimentReservation", "experimentKey": "exp-key", "reservationPercent": 10 }] } ``` #### removeExperiment Removes a traffic reservation for an experiment from a layer. ##### Parameters - `experimentKey`: The key of the experiment whose reservation you want to remove from the layer. Here's an example: ```json { "environmentKey": "production", "instructions": [{ "kind": "removeExperiment", "experimentKey": "exp-key" }] } ``` </details>
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
# File 'lib/launchdarkly_api/api/layers_api.rb', line 181 def update_layer_with_http_info(project_key, layer_key, layer_patch_input, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: LayersApi.update_layer ...' 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 LayersApi.update_layer" end # verify the required parameter 'layer_key' is set if @api_client.config.client_side_validation && layer_key.nil? fail ArgumentError, "Missing the required parameter 'layer_key' when calling LayersApi.update_layer" end # verify the required parameter 'layer_patch_input' is set if @api_client.config.client_side_validation && layer_patch_input.nil? fail ArgumentError, "Missing the required parameter 'layer_patch_input' when calling LayersApi.update_layer" end # resource path local_var_path = '/api/v2/projects/{projectKey}/layers/{layerKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'layerKey' + '}', CGI.escape(layer_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' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(layer_patch_input) # return_type return_type = opts[:debug_return_type] || 'LayerRep' # auth_names auth_names = opts[:debug_auth_names] || ['ApiKey'] = opts.merge( :operation => :"LayersApi.update_layer", :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, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: LayersApi#update_layer\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |