launchdarkly_api 25.2.0 → 25.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (184) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +64 -39
  3. data/docs/AIConfig.md +7 -5
  4. data/docs/AIConfigPatch.md +8 -4
  5. data/docs/AIConfigPost.md +8 -6
  6. data/docs/AIConfigTargeting.md +3 -3
  7. data/docs/AIConfigTargetingEnvironmentRule.md +8 -0
  8. data/docs/AIConfigTargetingEnvironmentRuleClause.md +2 -0
  9. data/docs/AIConfigVariation.md +1 -1
  10. data/docs/AIConfigVariationPatch.md +1 -1
  11. data/docs/AgentControlApi.md +110 -110
  12. data/docs/AgentOptimization.md +1 -1
  13. data/docs/AgentOptimizationJudge.md +1 -1
  14. data/docs/AgentOptimizationPost.md +1 -1
  15. data/docs/AgentSkill.md +3 -1
  16. data/docs/AgentSkillPatch.md +3 -1
  17. data/docs/AgentSkillPost.md +3 -1
  18. data/docs/AiConfigsMetricListingRep.md +2 -0
  19. data/docs/ApprovalsApi.md +1 -1
  20. data/docs/CreateFlagReleasePlanRequest.md +32 -0
  21. data/docs/EnvironmentReleasePlan.md +38 -0
  22. data/docs/EnvironmentReleasePlanClause.md +28 -0
  23. data/docs/EnvironmentReleasePlanMetric.md +20 -0
  24. data/docs/EnvironmentReleasePlanPhase.md +24 -0
  25. data/docs/EnvironmentReleasePlanProgressiveRelease.md +26 -0
  26. data/docs/EnvironmentReleasePlanProgressiveReleaseRep.md +26 -0
  27. data/docs/EnvironmentReleasePlanStep.md +22 -0
  28. data/docs/EnvironmentReleasePlans.md +22 -0
  29. data/docs/EnvironmentReleasePlansBetaApi.md +633 -0
  30. data/docs/EnvironmentReleasePlansLink.md +20 -0
  31. data/docs/EnvironmentReleasePlansPaginatedLinks.md +26 -0
  32. data/docs/EnvironmentReleasesMetricListingRep.md +2 -0
  33. data/docs/{ReleaseMethod.md → ExecutionMode.md} +2 -2
  34. data/docs/FeatureFlagsApi.md +1 -1
  35. data/docs/FlagReleasePlan.md +36 -0
  36. data/docs/FlagReleasePlanEnvironment.md +24 -0
  37. data/docs/FlagReleasePlanRequest.md +30 -0
  38. data/docs/FlagReleasePlansBetaApi.md +392 -0
  39. data/docs/FlagReleasePlansError.md +20 -0
  40. data/docs/FlagReleasePlansLink.md +20 -0
  41. data/docs/FlagReleasePlansPaginatedLinks.md +26 -0
  42. data/docs/ListFlagReleasePlansResponse.md +22 -0
  43. data/docs/MaintainerIdentifier.md +79 -0
  44. data/docs/MaintainerIdentifierMember.md +20 -0
  45. data/docs/MaintainerIdentifierTeam.md +20 -0
  46. data/docs/MaintainerResponse.md +79 -0
  47. data/docs/MaintainerResponseMember.md +26 -0
  48. data/docs/MaintainerResponseTeam.md +22 -0
  49. data/docs/PinnedSkillToolRef.md +20 -0
  50. data/docs/PostEnvironmentReleasePlanRequest.md +26 -0
  51. data/docs/PutDefaultEnvironmentReleasePlanRequest.md +18 -0
  52. data/docs/PutEnvironmentReleasePlanRequest.md +26 -0
  53. data/docs/PutFlagReleasePlanRequest.md +32 -0
  54. data/docs/QuickStats.md +2 -2
  55. data/docs/SkillToolRef.md +20 -0
  56. data/docs/ToolReferences.md +5 -1
  57. data/docs/ToolSkillReference.md +22 -0
  58. data/docs/TriggerType.md +15 -0
  59. data/lib/launchdarkly_api/api/agent_control_api.rb +98 -98
  60. data/lib/launchdarkly_api/api/approvals_api.rb +2 -2
  61. data/lib/launchdarkly_api/api/environment_release_plans_beta_api.rb +730 -0
  62. data/lib/launchdarkly_api/api/feature_flags_api.rb +2 -2
  63. data/lib/launchdarkly_api/api/{release_policies_beta_api.rb → flag_release_plans_beta_api.rb} +173 -212
  64. data/lib/launchdarkly_api/models/agent_optimization.rb +1 -1
  65. data/lib/launchdarkly_api/models/agent_optimization_judge.rb +1 -1
  66. data/lib/launchdarkly_api/models/agent_optimization_post.rb +1 -1
  67. data/lib/launchdarkly_api/models/agent_skill.rb +14 -2
  68. data/lib/launchdarkly_api/models/agent_skill_patch.rb +16 -4
  69. data/lib/launchdarkly_api/models/agent_skill_post.rb +16 -4
  70. data/lib/launchdarkly_api/models/ai_config.rb +16 -6
  71. data/lib/launchdarkly_api/models/ai_config_patch.rb +27 -7
  72. data/lib/launchdarkly_api/models/ai_config_post.rb +19 -9
  73. data/lib/launchdarkly_api/models/ai_config_targeting.rb +3 -3
  74. data/lib/launchdarkly_api/models/ai_config_targeting_environment_rule.rb +40 -1
  75. data/lib/launchdarkly_api/models/ai_config_targeting_environment_rule_clause.rb +11 -1
  76. data/lib/launchdarkly_api/models/ai_config_variation.rb +1 -1
  77. data/lib/launchdarkly_api/models/ai_config_variation_patch.rb +1 -1
  78. data/lib/launchdarkly_api/models/ai_configs_metric_listing_rep.rb +11 -1
  79. data/lib/launchdarkly_api/models/create_flag_release_plan_request.rb +335 -0
  80. data/lib/launchdarkly_api/models/environment_release_plan.rb +426 -0
  81. data/lib/launchdarkly_api/models/{release_policies_access_allowed_reason.rb → environment_release_plan_clause.rb} +98 -65
  82. data/lib/launchdarkly_api/models/{release_policies_access_allowed_rep.rb → environment_release_plan_metric.rb} +28 -41
  83. data/lib/launchdarkly_api/models/environment_release_plan_phase.rb +208 -0
  84. data/lib/launchdarkly_api/models/environment_release_plan_progressive_release.rb +285 -0
  85. data/lib/launchdarkly_api/models/{release_policies_access_denied_reason.rb → environment_release_plan_progressive_release_rep.rb} +85 -67
  86. data/lib/launchdarkly_api/models/{release_policy_stage.rb → environment_release_plan_step.rb} +43 -4
  87. data/lib/launchdarkly_api/models/{release_policies_response.rb → environment_release_plans.rb} +16 -7
  88. data/lib/launchdarkly_api/models/{release_policies_access_denied.rb → environment_release_plans_link.rb} +16 -50
  89. data/lib/launchdarkly_api/models/environment_release_plans_paginated_links.rb +200 -0
  90. data/lib/launchdarkly_api/models/environment_releases_metric_listing_rep.rb +11 -1
  91. data/lib/launchdarkly_api/models/{release_method.rb → execution_mode.rb} +6 -7
  92. data/lib/launchdarkly_api/models/expanded_ai_config.rb +1 -1
  93. data/lib/launchdarkly_api/models/flag_release_plan.rb +359 -0
  94. data/lib/launchdarkly_api/models/{put_release_policy_request.rb → flag_release_plan_environment.rb} +47 -65
  95. data/lib/launchdarkly_api/models/{post_release_policy_request.rb → flag_release_plan_request.rb} +64 -67
  96. data/lib/launchdarkly_api/models/flag_release_plans_error.rb +208 -0
  97. data/lib/launchdarkly_api/models/flag_release_plans_link.rb +156 -0
  98. data/lib/launchdarkly_api/models/flag_release_plans_paginated_links.rb +200 -0
  99. data/lib/launchdarkly_api/models/list_flag_release_plans_response.rb +202 -0
  100. data/lib/launchdarkly_api/models/maintainer_identifier.rb +56 -0
  101. data/lib/launchdarkly_api/models/maintainer_identifier_member.rb +214 -0
  102. data/lib/launchdarkly_api/models/{progressive_release_config.rb → maintainer_identifier_team.rb} +66 -32
  103. data/lib/launchdarkly_api/models/maintainer_response.rb +56 -0
  104. data/lib/launchdarkly_api/models/maintainer_response_member.rb +225 -0
  105. data/lib/launchdarkly_api/models/maintainer_response_team.rb +206 -0
  106. data/lib/launchdarkly_api/models/{release_policies_access_rep.rb → pinned_skill_tool_ref.rb} +46 -45
  107. data/lib/launchdarkly_api/models/{release_policy.rb → post_environment_release_plan_request.rb} +93 -120
  108. data/lib/launchdarkly_api/models/{release_policies_access.rb → put_default_environment_release_plan_request.rb} +33 -44
  109. data/lib/launchdarkly_api/models/put_environment_release_plan_request.rb +285 -0
  110. data/lib/launchdarkly_api/models/put_flag_release_plan_request.rb +309 -0
  111. data/lib/launchdarkly_api/models/quick_stats.rb +2 -2
  112. data/lib/launchdarkly_api/models/skill_tool_ref.rb +195 -0
  113. data/lib/launchdarkly_api/models/tool_references.rb +26 -4
  114. data/lib/launchdarkly_api/models/tool_skill_reference.rb +220 -0
  115. data/lib/launchdarkly_api/models/trigger_type.rb +42 -0
  116. data/lib/launchdarkly_api/version.rb +1 -1
  117. data/lib/launchdarkly_api.rb +35 -16
  118. data/spec/api/agent_control_api_spec.rb +49 -49
  119. data/spec/api/approvals_api_spec.rb +1 -1
  120. data/spec/api/environment_release_plans_beta_api_spec.rb +156 -0
  121. data/spec/api/feature_flags_api_spec.rb +1 -1
  122. data/spec/api/{release_policies_beta_api_spec.rb → flag_release_plans_beta_api_spec.rb} +43 -56
  123. data/spec/models/agent_skill_patch_spec.rb +6 -0
  124. data/spec/models/agent_skill_post_spec.rb +6 -0
  125. data/spec/models/agent_skill_spec.rb +6 -0
  126. data/spec/models/ai_config_patch_spec.rb +12 -0
  127. data/spec/models/ai_config_post_spec.rb +6 -0
  128. data/spec/models/ai_config_spec.rb +6 -0
  129. data/spec/models/ai_config_targeting_environment_rule_clause_spec.rb +6 -0
  130. data/spec/models/ai_config_targeting_environment_rule_spec.rb +24 -0
  131. data/spec/models/ai_configs_metric_listing_rep_spec.rb +6 -0
  132. data/spec/models/{release_policy_spec.rb → create_flag_release_plan_request_spec.rb} +13 -19
  133. data/spec/models/{release_policies_access_allowed_reason_spec.rb → environment_release_plan_clause_spec.rb} +16 -16
  134. data/spec/models/{release_policies_access_rep_spec.rb → environment_release_plan_metric_spec.rb} +8 -8
  135. data/spec/models/environment_release_plan_phase_spec.rb +54 -0
  136. data/spec/models/environment_release_plan_progressive_release_rep_spec.rb +68 -0
  137. data/spec/models/environment_release_plan_progressive_release_spec.rb +68 -0
  138. data/spec/models/environment_release_plan_spec.rb +100 -0
  139. data/spec/models/{release_policies_access_allowed_rep_spec.rb → environment_release_plan_step_spec.rb} +14 -8
  140. data/spec/models/{release_policies_access_denied_spec.rb → environment_release_plans_link_spec.rb} +8 -8
  141. data/spec/models/{guarded_release_config_spec.rb → environment_release_plans_paginated_links_spec.rb} +11 -17
  142. data/spec/models/environment_release_plans_spec.rb +48 -0
  143. data/spec/models/environment_releases_metric_listing_rep_spec.rb +6 -0
  144. data/spec/models/{release_method_spec.rb → execution_mode_spec.rb} +6 -6
  145. data/spec/models/flag_release_plan_environment_spec.rb +54 -0
  146. data/spec/models/{release_policies_access_denied_reason_spec.rb → flag_release_plan_request_spec.rb} +18 -16
  147. data/spec/models/flag_release_plan_spec.rb +90 -0
  148. data/spec/models/{release_policy_scope_spec.rb → flag_release_plans_error_spec.rb} +8 -8
  149. data/spec/models/{release_policy_stage_spec.rb → flag_release_plans_link_spec.rb} +8 -8
  150. data/spec/models/{put_release_policy_request_spec.rb → flag_release_plans_paginated_links_spec.rb} +11 -11
  151. data/spec/models/list_flag_release_plans_response_spec.rb +48 -0
  152. data/spec/models/maintainer_identifier_member_spec.rb +46 -0
  153. data/spec/models/maintainer_identifier_spec.rb +44 -0
  154. data/spec/models/{progressive_release_config_spec.rb → maintainer_identifier_team_spec.rb} +12 -8
  155. data/spec/models/maintainer_response_member_spec.rb +64 -0
  156. data/spec/models/maintainer_response_spec.rb +44 -0
  157. data/spec/models/maintainer_response_team_spec.rb +52 -0
  158. data/spec/models/{release_policies_access_spec.rb → pinned_skill_tool_ref_spec.rb} +8 -8
  159. data/spec/models/{post_release_policy_request_spec.rb → post_environment_release_plan_request_spec.rb} +15 -17
  160. data/spec/models/put_default_environment_release_plan_request_spec.rb +36 -0
  161. data/spec/models/put_environment_release_plan_request_spec.rb +64 -0
  162. data/spec/models/put_flag_release_plan_request_spec.rb +78 -0
  163. data/spec/models/{release_policies_response_spec.rb → skill_tool_ref_spec.rb} +8 -8
  164. data/spec/models/tool_references_spec.rb +12 -0
  165. data/spec/models/tool_skill_reference_spec.rb +48 -0
  166. data/spec/models/trigger_type_spec.rb +30 -0
  167. metadata +141 -65
  168. data/docs/GuardedReleaseConfig.md +0 -28
  169. data/docs/PostReleasePolicyRequest.md +0 -28
  170. data/docs/ProgressiveReleaseConfig.md +0 -20
  171. data/docs/PutReleasePolicyRequest.md +0 -26
  172. data/docs/ReleasePoliciesAccess.md +0 -20
  173. data/docs/ReleasePoliciesAccessAllowedReason.md +0 -28
  174. data/docs/ReleasePoliciesAccessAllowedRep.md +0 -20
  175. data/docs/ReleasePoliciesAccessDenied.md +0 -20
  176. data/docs/ReleasePoliciesAccessDeniedReason.md +0 -28
  177. data/docs/ReleasePoliciesAccessRep.md +0 -20
  178. data/docs/ReleasePoliciesBetaApi.md +0 -466
  179. data/docs/ReleasePoliciesResponse.md +0 -20
  180. data/docs/ReleasePolicy.md +0 -34
  181. data/docs/ReleasePolicyScope.md +0 -20
  182. data/docs/ReleasePolicyStage.md +0 -20
  183. data/lib/launchdarkly_api/models/guarded_release_config.rb +0 -224
  184. data/lib/launchdarkly_api/models/release_policy_scope.rb +0 -181
@@ -0,0 +1,730 @@
1
+ =begin
2
+ #LaunchDarkly REST API
3
+
4
+ #This documentation describes LaunchDarkly's REST API. To access the complete OpenAPI spec directly, use [Get OpenAPI spec](https://launchdarkly.com/docs/api/other/get-openapi-spec). To learn how to use LaunchDarkly using the user interface (UI) instead, read our [product documentation](https://launchdarkly.com/docs/home). ## Authentication LaunchDarkly's REST API uses the HTTPS protocol with a minimum TLS version of 1.2. All REST API resources are authenticated with either [personal or service access tokens](https://launchdarkly.com/docs/home/account/api), or session cookies. Other authentication mechanisms are not supported. You can manage personal access tokens on your [**Authorization**](https://app.launchdarkly.com/settings/authorization) page in the LaunchDarkly UI. LaunchDarkly also has SDK keys, mobile keys, and client-side IDs that are used by our server-side SDKs, mobile SDKs, and JavaScript-based SDKs, respectively. **These keys cannot be used to access our REST API**. These keys are environment-specific, and can only perform read-only operations such as fetching feature flag settings. | Auth mechanism | Allowed resources | Use cases | | ----------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -------------------------------------------------- | | [Personal or service access tokens](https://launchdarkly.com/docs/home/account/api) | Can be customized on a per-token basis | Building scripts, custom integrations, data export. | | SDK keys | Can only access read-only resources specific to server-side SDKs. Restricted to a single environment. | Server-side SDKs | | Mobile keys | Can only access read-only resources specific to mobile SDKs, and only for flags marked available to mobile keys. Restricted to a single environment. | Mobile SDKs | | Client-side ID | Can only access read-only resources specific to JavaScript-based client-side SDKs, and only for flags marked available to client-side. Restricted to a single environment. | Client-side JavaScript | > #### Keep your access tokens and SDK keys private > > Access tokens should _never_ be exposed in untrusted contexts. Never put an access token in client-side JavaScript, or embed it in a mobile application. LaunchDarkly has special mobile keys that you can embed in mobile apps. If you accidentally expose an access token or SDK key, you can reset it from your [**Authorization**](https://app.launchdarkly.com/settings/authorization) page. > > The client-side ID is safe to embed in untrusted contexts. It's designed for use in client-side JavaScript. ### Authentication using request header The preferred way to authenticate with the API is by adding an `Authorization` header containing your access token to your requests. The value of the `Authorization` header must be your access token. Manage personal access tokens from the [**Authorization**](https://app.launchdarkly.com/settings/authorization) page. ### Authentication using session cookie For testing purposes, you can make API calls directly from your web browser. If you are logged in to the LaunchDarkly application, the API will use your existing session to authenticate calls. Depending on the permissions granted as part of your [role](https://launchdarkly.com/docs/home/account/roles), you may not have permission to perform some API calls. You will receive a `401` response code in that case. > ### Modifying the Origin header causes an error > > LaunchDarkly validates that the Origin header for any API request authenticated by a session cookie matches the expected Origin header. The expected Origin header is `https://app.launchdarkly.com`. > > If the Origin header does not match what's expected, LaunchDarkly returns an error. This error can prevent the LaunchDarkly app from working correctly. > > Any browser extension that intentionally changes the Origin header can cause this problem. For example, Cross-Origin Resource Sharing (CORS) extensions used during development can modify the Origin header and cause the app to fail. > > To prevent this error, do not modify your Origin header. > > LaunchDarkly does not require origin matching when authenticating with an access token, so this issue does not affect normal API usage. ## Representations All resources expect and return JSON response bodies. Error responses also send a JSON body. To learn more about the error format of the API, read [Errors](https://launchdarkly.com/docs/api#errors). In practice this means that you always get a response with a `Content-Type` header set to `application/json`. In addition, request bodies for `PATCH`, `POST`, and `PUT` requests must be encoded as JSON with a `Content-Type` header set to `application/json`. Unless an endpoint's documentation says otherwise, the API ignores request body fields that are not part of that endpoint's request schema, and does not return an error for them. A successful response does not mean that every field you sent was applied. To confirm the result, check the response body. ### Summary and detailed representations When you fetch a list of resources, the response includes only the most important attributes of each resource. This is a _summary representation_ of the resource. When you fetch an individual resource, such as a single feature flag, you receive a _detailed representation_ of the resource. The best way to find a detailed representation is to follow links. Every summary representation includes a link to its detailed representation. ### Expanding responses Sometimes the detailed representation of a resource does not include all of the attributes of the resource by default. If this is the case, the request method will clearly document this and describe which attributes you can include in an expanded response. To include the additional attributes, append the `expand` request parameter to your request and add a comma-separated list of the attributes to include. For example, when you append `?expand=members,maintainers` to the [Get team](https://launchdarkly.com/docs/api/teams/get-team) endpoint, the expanded response includes both of these attributes. ### Links and addressability The best way to navigate the API is by following links. These are attributes in representations that link to other resources. The API always uses the same format for links: - Links to other resources within the API are encapsulated in a `_links` object - If the resource has a corresponding link to HTML content on the site, it is stored in a special `_site` link Each link has two attributes: - An `href`, which contains the URL - A `type`, which describes the content type For example, a feature resource might return the following: ```json { \"_links\": { \"parent\": { \"href\": \"/api/features\", \"type\": \"application/json\" }, \"self\": { \"href\": \"/api/features/sort.order\", \"type\": \"application/json\" } }, \"_site\": { \"href\": \"/features/sort.order\", \"type\": \"text/html\" } } ``` From this, you can navigate to the parent collection of features by following the `parent` link, or navigate to the site page for the feature by following the `_site` link. Collections are always represented as a JSON object with an `items` attribute containing an array of representations. Like all other representations, collections have `_links` defined at the top level. Paginated collections include `first`, `last`, `next`, and `prev` links containing a URL with the respective set of elements in the collection. ## Updates Resources that accept partial updates use the `PATCH` verb. Most resources support the [JSON patch](https://launchdarkly.com/docs/api#updates-using-json-patch) format. Some resources also support the [JSON merge patch](https://launchdarkly.com/docs/api#updates-using-json-merge-patch) format, and some resources support the [semantic patch](https://launchdarkly.com/docs/api#updates-using-semantic-patch) format, which is a way to specify the modifications to perform as a set of executable instructions. Each resource supports optional [comments](https://launchdarkly.com/docs/api#updates-with-comments) that you can submit with updates. Comments appear in outgoing webhooks, the audit log, and other integrations. When a resource supports both JSON patch and semantic patch, we document both in the request method. However, the specific request body fields and descriptions included in our documentation only match one type of patch or the other. ### Updates using JSON patch [JSON patch](https://datatracker.ietf.org/doc/html/rfc6902) is a way to specify the modifications to perform on a resource. JSON patch uses paths and a limited set of operations to describe how to transform the current state of the resource into a new state. JSON patch documents are always arrays, where each element contains an operation, a path to the field to update, and the new value. For example, in this feature flag representation: ```json { \"name\": \"New recommendations engine\", \"key\": \"engine.enable\", \"description\": \"This is the description\", ... } ``` You can change the feature flag's description with the following patch document: ```json [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"This is the new description\" }] ``` You can specify multiple modifications to perform in a single request. You can also test that certain preconditions are met before applying the patch: ```json [ { \"op\": \"test\", \"path\": \"/version\", \"value\": 10 }, { \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" } ] ``` The above patch request tests whether the feature flag's `version` is `10`, and if so, changes the feature flag's description. Attributes that are not editable, such as a resource's `_links`, have names that start with an underscore. ### Updates using JSON merge patch [JSON merge patch](https://datatracker.ietf.org/doc/html/rfc7386) is another format for specifying the modifications to perform on a resource. JSON merge patch is less expressive than JSON patch. However, in many cases it is simpler to construct a merge patch document. For example, you can change a feature flag's description with the following merge patch document: ```json { \"description\": \"New flag description\" } ``` ### Updates using semantic patch Some resources support the semantic patch format. A semantic patch is a way to specify the modifications to perform on a resource as a set of executable instructions. Semantic patch allows you to be explicit about intent using precise, custom instructions. In many cases, you can define semantic patch instructions independently of the current state of the resource. This can be useful when defining a change that may be applied at a future date. To make a semantic patch request, you must append `domain-model=launchdarkly.semanticpatch` to your `Content-Type` header. Here's how: ``` Content-Type: application/json; domain-model=launchdarkly.semanticpatch ``` If you call a semantic patch resource without this header, you will receive a `400` response because your semantic patch will be interpreted as a JSON patch. The body of a semantic patch request takes the following properties: * `comment` (string): (Optional) A description of the update. * `environmentKey` (string): (Required for some resources only) The environment key. * `instructions` (array): (Required) A list of actions the update should perform. Each action in the list must be an object with a `kind` property that indicates the instruction. If the instruction requires parameters, you must include those parameters as additional fields in the object. The documentation for each resource that supports semantic patch includes the available instructions and any additional parameters. For example: ```json { \"comment\": \"optional comment\", \"instructions\": [ {\"kind\": \"turnFlagOn\"} ] } ``` Semantic patches are not applied partially; either all of the instructions are applied or none of them are. If **any** instruction is invalid, the endpoint returns an error and will not change the resource. If all instructions are valid, the request succeeds and the resources are updated if necessary, or left unchanged if they are already in the state you request. ### Updates with comments You can submit optional comments with `PATCH` changes. To submit a comment along with a JSON patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"patch\": [{ \"op\": \"replace\", \"path\": \"/description\", \"value\": \"The new description\" }] } ``` To submit a comment along with a JSON merge patch document, use the following format: ```json { \"comment\": \"This is a comment string\", \"merge\": { \"description\": \"New flag description\" } } ``` To submit a comment along with a semantic patch, use the following format: ```json { \"comment\": \"This is a comment string\", \"instructions\": [ {\"kind\": \"turnFlagOn\"} ] } ``` ## Errors The API always returns errors in a common format. Here's an example: ```json { \"code\": \"invalid_request\", \"message\": \"A feature with that key already exists\", \"id\": \"30ce6058-87da-11e4-b116-123b93f75cba\" } ``` The `code` indicates the general class of error. The `message` is a human-readable explanation of what went wrong. The `id` is a unique identifier. Use it when you're working with LaunchDarkly Support to debug a problem with a specific API call. ### HTTP status error response codes | Code | Definition | Description | Possible Solution | | ---- | ----------------- | ------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | | 400 | Invalid request | The request cannot be understood. | Ensure JSON syntax in request body is correct. | | 401 | Invalid access token | Requestor is unauthorized or does not have permission for this API call. | Ensure your API access token is valid and has the appropriate permissions. | | 403 | Forbidden | Requestor does not have access to this resource. | Ensure that the account member or access token has proper permissions set. | | 404 | Invalid resource identifier | The requested resource is not valid. | Ensure that the resource is correctly identified by ID or key. | | 405 | Method not allowed | The request method is not allowed on this resource. | Ensure that the HTTP verb is correct. | | 409 | Conflict | The API request can not be completed because it conflicts with a concurrent API request. | Retry your request. | | 422 | Unprocessable entity | The API request can not be completed because the update description can not be understood. | Ensure that the request body is correct for the type of patch you are using, either JSON patch or semantic patch. | 429 | Too many requests | Read [Rate limiting](https://launchdarkly.com/docs/api#rate-limiting). | Wait and try again later. | ## CORS The LaunchDarkly API supports Cross Origin Resource Sharing (CORS) for AJAX requests from any origin. If an `Origin` header is given in a request, it will be echoed as an explicitly allowed origin. Otherwise the request returns a wildcard, `Access-Control-Allow-Origin: *`. For more information on CORS, read the [CORS W3C Recommendation](http://www.w3.org/TR/cors). Example CORS headers might look like: ```http Access-Control-Allow-Headers: Accept, Content-Type, Content-Length, Accept-Encoding, Authorization Access-Control-Allow-Methods: OPTIONS, GET, DELETE, PATCH Access-Control-Allow-Origin: * Access-Control-Max-Age: 300 ``` You can make authenticated CORS calls just as you would make same-origin calls, using either [token or session-based authentication](https://launchdarkly.com/docs/api#authentication). If you are using session authentication, you should set the `withCredentials` property for your `xhr` request to `true`. You should never expose your access tokens to untrusted entities. ## Rate limiting We use several rate-limiting strategies to ensure the availability of our APIs. Rate-limited calls to our APIs return a `429` status code and include headers to indicate the current rate limit status. The specific headers returned depend on the API route that was called. Limits differ based on the route, authentication mechanism, and other factors. Each set of headers below appears only when the corresponding limit is being enforced for your call. A given route may be subject to any combination of these limits, so a response can include one, several, or none of these headers. A missing header indicates that the limit was not applied to this specific call; it does not necessarily indicate that the limit does not exist. To reduce usage before hitting a `429` status, program against whichever rate limit headers are present rather than expecting a specific header. We do not publicly document the specific number of calls permitted by any of these limits, and these limits may change. We encourage clients to program against the specification and rely on the headers described below, rather than hardcoding the current limits. > ### Rate limiting and SDKs > > LaunchDarkly SDKs are never rate limited and do not use the API endpoints defined here. LaunchDarkly uses a different set of approaches, including streaming/server-sent events and a global CDN, to ensure availability to the routes used by LaunchDarkly SDKs. ### Global rate limits Authenticated requests are subject to a global limit. This is the maximum number of calls that your account can make to the API per ten seconds. All service and personal access tokens on the account share this limit, so exceeding the limit with one access token will impact other tokens. Calls that are subject to global rate limits may return the headers below: | Header name | Description | | ------------------------------ | -------------------------------------------------------------------------------- | | `X-Ratelimit-Global-Limit` | The maximum number of requests the account is permitted to make per ten seconds. | | `X-Ratelimit-Global-Remaining` | The number of requests remaining in the current global rate limit window. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | ### Route-level rate limits Some authenticated routes have custom rate limits. These also reset every ten seconds. Any service or personal access tokens hitting the same route share this limit, so exceeding the limit with one access token may impact other tokens. Calls that are subject to route-level rate limits return the headers below: | Header name | Description | | ----------------------------- | ----------------------------------------------------------------------------------------------------- | | `X-Ratelimit-Route-Limit` | The maximum number of requests to the current route permitted per ten seconds. | | `X-Ratelimit-Route-Remaining` | The number of requests remaining for the current route in the current rate limit window. | | `X-Ratelimit-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | A _route_ represents a specific URL pattern and verb. For example, the [Delete environment](https://launchdarkly.com/docs/api/environments/delete-environment) endpoint is considered a single route, and each call to delete an environment counts against your route-level rate limit for that route. ### Access token rate limits Some calls are rate limited per access token. Unlike the global and route-level limits, this limit applies to a single service or personal access token on its own. Exceeding a limit with one access token does not affect other tokens on the account. Calls that are subject to access token rate limits return these headers: | Header name | Description | | ---------------------------------- | --------------------------------------------------------------------------------------- | | `X-Ratelimit-Auth-Token-Limit` | The maximum number of requests the access token can make per ten seconds. | | `X-Ratelimit-Auth-Token-Remaining` | The number of requests remaining for the access token in the current rate limit window. | | `X-Ratelimit-Auth-Token-Reset` | The time at which the current rate limit window resets in epoch milliseconds. | Unlike the other rate limits, access token rate limits report their own reset time in the `X-Ratelimit-Auth-Token-Reset` header instead of in `X-Ratelimit-Reset`. ### IP-based rate limiting We also employ IP-based rate limiting on some API routes. If you hit an IP-based rate limit, your API response will include a `Retry-After` header indicating how long to wait before re-trying the call. Clients must wait at least `Retry-After` seconds before making additional calls to our API, and should employ jitter and backoff strategies to avoid triggering rate limits again. ## OpenAPI (Swagger) and client libraries We have a [complete OpenAPI (Swagger) specification](https://app.launchdarkly.com/api/v2/openapi.json) for our API. We auto-generate multiple client libraries based on our OpenAPI specification. To learn more, visit the [collection of client libraries on GitHub](https://github.com/search?q=topic%3Alaunchdarkly-api+org%3Alaunchdarkly&type=Repositories). Alternatively, you can use the specification to generate client libraries to interact with our REST API in your language of choice. Or, you can refer to our API endpoints' documentation for guidance on how to make requests with a common HTTP library in your language of choice. Our OpenAPI specification is supported by several API-based tools such as Postman and Insomnia. In many cases, you can directly import our specification to explore our APIs. ## Method overriding Some firewalls and HTTP clients restrict the use of verbs other than `GET` and `POST`. In those environments, our API endpoints that use `DELETE`, `PATCH`, and `PUT` verbs are inaccessible. To avoid this issue, our API supports the `X-HTTP-Method-Override` header, allowing clients to \"tunnel\" `DELETE`, `PATCH`, and `PUT` requests using a `POST` request. For example, to call a `PATCH` endpoint using a `POST` request, you can include `X-HTTP-Method-Override:PATCH` as a header. ## Beta resources We sometimes release new API resources in **beta** status before we release them with general availability. Resources that are in beta are still undergoing testing and development. They may change without notice, including becoming backwards incompatible. We try to promote resources into general availability as quickly as possible. This happens after sufficient testing and when we're satisfied that we no longer need to make backwards-incompatible changes. We mark beta resources with a \"Beta\" callout in our documentation, pictured below: > ### This feature is in beta > > To use this feature, pass in a header including the `LD-API-Version` key with value set to `beta`. Use this header with each call. To learn more, read [Beta resources](https://launchdarkly.com/docs/api#beta-resources). > > Resources that are in beta are still undergoing testing and development. They may change without notice, including becoming backwards incompatible. ### Using beta resources To use a beta resource, you must include a header in the request. If you call a beta resource without this header, you receive a `403` response. Use this header: ``` LD-API-Version: beta ``` ## Federal and EU environments In addition to the commercial versions, LaunchDarkly offers instances for federal agencies and those based in the European Union (EU). ### Federal environments The version of LaunchDarkly that is available on domains controlled by the United States government is different from the version of LaunchDarkly available to the general public. If you are an employee or contractor for a United States federal agency and use LaunchDarkly in your work, you likely use the federal instance of LaunchDarkly. If you are working in the federal instance of LaunchDarkly, the base URI for each request is `https://app.launchdarkly.us`. To learn more, read [LaunchDarkly in federal environments](https://launchdarkly.com/docs/home/infrastructure/federal). ### EU environments The version of LaunchDarkly that is available in the EU is different from the version of LaunchDarkly available to other regions. If you are based in the EU, you likely use the EU instance of LaunchDarkly. The LaunchDarkly EU instance complies with EU data residency principles, including the protection and confidentiality of EU customer information. If you are working in the EU instance of LaunchDarkly, the base URI for each request is `https://app.eu.launchdarkly.com`. To learn more, read [LaunchDarkly in the European Union (EU)](https://launchdarkly.com/docs/home/infrastructure/eu). ## Versioning We try hard to keep our REST API backwards compatible, but we occasionally have to make backwards-incompatible changes in the process of shipping new features. These breaking changes can cause unexpected behavior if you don't prepare for them accordingly. Updates to our REST API include support for the latest features in LaunchDarkly. We also release a new version of our REST API every time we make a breaking change. We provide simultaneous support for multiple API versions so you can migrate from your current API version to a new version at your own pace. ### Setting the API version per request You can set the API version on a specific request by sending an `LD-API-Version` header, as shown in the example below: ``` LD-API-Version: 20240415 ``` The header value is the version number of the API version you would like to request. The number for each version corresponds to the date the version was released in `yyyymmdd` format. In the example above the version `20240415` corresponds to April 15, 2024. ### Setting the API version per access token When you create an access token, you must specify a specific version of the API to use. This ensures that integrations using this token cannot be broken by version changes. Tokens created before versioning was released have their version set to `20160426`, which is the version of the API that existed before the current versioning scheme, so that they continue working the same way they did before versioning. If you would like to upgrade your integration to use a new API version, you can explicitly set the header described above. > ### Best practice: Set the header for every client or integration > > We recommend that you set the API version header explicitly in any client or integration you build. > > Only rely on the access token API version during manual testing. ### API version changelog <table> <tr> <th>Version</th> <th>Changes</th> <th>End of life (EOL)</th> </tr> <tr> <td>`20240415`</td> <td> <ul><li>Changed several endpoints from unpaginated to paginated. Use the `limit` and `offset` query parameters to page through the results.</li> <li>Changed the [list access tokens](https://launchdarkly.com/docs/api/access-tokens/get-tokens) endpoint: <ul><li>Response is now paginated with a default limit of `25`</li></ul></li> <li>Changed the [list account members](https://launchdarkly.com/docs/api/account-members/get-members) endpoint: <ul><li>The `accessCheck` filter is no longer available</li></ul></li> <li>Changed the [list custom roles](https://launchdarkly.com/docs/api/custom-roles/get-custom-roles) endpoint: <ul><li>Response is now paginated with a default limit of `20`</li></ul></li> <li>Changed the [list feature flags](https://launchdarkly.com/docs/api/feature-flags/get-feature-flags) endpoint: <ul><li>Response is now paginated with a default limit of `20`</li><li>The `environments` field is now only returned if the request is filtered by environment, using the `filterEnv` query parameter</li><li>The `followerId`, `hasDataExport`, `status`, `contextKindTargeted`, and `segmentTargeted` filters are no longer available</li><li>The `compare` query parameter is no longer available</li></ul></li> <li>Changed the [list segments](https://launchdarkly.com/docs/api/segments/get-segments) endpoint: <ul><li>Response is now paginated with a default limit of `20`</li></ul></li> <li>Changed the [list teams](https://launchdarkly.com/docs/api/teams/get-teams) endpoint: <ul><li>The `expand` parameter no longer supports including `projects` or `roles`</li><li>In paginated results, the maximum page size is now 100</li></ul></li> <li>Changed the [get workflows](https://launchdarkly.com/docs/api/workflows/get-workflows) endpoint: <ul><li>Response is now paginated with a default limit of `20`</li><li>The `_conflicts` field in the response is no longer available</li></ul></li> </ul> </td> <td>Current</td> </tr> <tr> <td>`20220603`</td> <td> <ul><li>Changed the [list projects](https://launchdarkly.com/docs/api/projects/get-projects) return value:<ul><li>Response is now paginated with a default limit of `20`.</li><li>Added support for filter and sort.</li><li>The project `environments` field is now expandable. This field is omitted by default.</li></ul></li><li>Changed the [get project](https://launchdarkly.com/docs/api/projects/get-project) return value:<ul><li>The `environments` field is now expandable. This field is omitted by default.</li></ul></li></ul> </td> <td>2025-04-15</td> </tr> <tr> <td>`20210729`</td> <td> <ul><li>Changed the [create approval request](https://launchdarkly.com/docs/api/approvals/post-approval-request) return value. It now returns HTTP Status Code `201` instead of `200`.</li><li> Changed the [get user](https://launchdarkly.com/docs/api/users/get-user) return value. It now returns a user record, not a user. </li><li>Added additional optional fields to environment, segments, flags, members, and segments, including the ability to create big segments. </li><li> Added default values for flag variations when new environments are created. </li><li>Added filtering and pagination for getting flags and members, including `limit`, `number`, `filter`, and `sort` query parameters. </li><li>Added endpoints for expiring user targets for flags and segments, scheduled changes, access tokens, Relay Proxy configuration, integrations and subscriptions, and approvals. </li></ul> </td> <td>2023-06-03</td> </tr> <tr> <td>`20191212`</td> <td> <ul><li>[List feature flags](https://launchdarkly.com/docs/api/feature-flags/get-feature-flags) now defaults to sending summaries of feature flag configurations, equivalent to setting the query parameter `summary=true`. Summaries omit flag targeting rules and individual user targets from the payload. </li><li> Added endpoints for flags, flag status, projects, environments, audit logs, members, users, custom roles, segments, usage, streams, events, and data export. </li></ul> </td> <td>2022-07-29</td> </tr> <tr> <td>`20160426`</td> <td> <ul><li>Initial versioning of API. Tokens created before versioning have their version set to this.</li></ul> </td> <td>2020-12-12</td> </tr> </table> To learn more about how EOL is determined, read LaunchDarkly's [End of Life (EOL) Policy](https://launchdarkly.com/policies/end-of-life-policy/).
5
+
6
+ The version of the OpenAPI document: 2.0
7
+ Contact: support@launchdarkly.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.18.0
10
+
11
+ =end
12
+
13
+ require 'cgi'
14
+
15
+ module LaunchDarklyApi
16
+ class EnvironmentReleasePlansBetaApi
17
+ attr_accessor :api_client
18
+
19
+ def initialize(api_client = ApiClient.default)
20
+ @api_client = api_client
21
+ end
22
+ # Clear the default release plan
23
+ # Clear the environment's default release plan, incrementing the formerly-default plan's version by 1; the environment then has none. Idempotent: returns `204` whether or not a default was set.
24
+ # @param ld_api_version [String] Version of the endpoint.
25
+ # @param project_key [String] The project key
26
+ # @param environment_key [String] The environment key
27
+ # @param [Hash] opts the optional parameters
28
+ # @return [nil]
29
+ def delete_default_environment_release_plan(ld_api_version, project_key, environment_key, opts = {})
30
+ delete_default_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, opts)
31
+ nil
32
+ end
33
+
34
+ # Clear the default release plan
35
+ # Clear the environment&#39;s default release plan, incrementing the formerly-default plan&#39;s version by 1; the environment then has none. Idempotent: returns &#x60;204&#x60; whether or not a default was set.
36
+ # @param ld_api_version [String] Version of the endpoint.
37
+ # @param project_key [String] The project key
38
+ # @param environment_key [String] The environment key
39
+ # @param [Hash] opts the optional parameters
40
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
41
+ def delete_default_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, opts = {})
42
+ if @api_client.config.debugging
43
+ @api_client.config.logger.debug 'Calling API: EnvironmentReleasePlansBetaApi.delete_default_environment_release_plan ...'
44
+ end
45
+ # verify the required parameter 'ld_api_version' is set
46
+ if @api_client.config.client_side_validation && ld_api_version.nil?
47
+ fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling EnvironmentReleasePlansBetaApi.delete_default_environment_release_plan"
48
+ end
49
+ # verify enum value
50
+ allowable_values = ["beta"]
51
+ if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
52
+ fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
53
+ end
54
+ # verify the required parameter 'project_key' is set
55
+ if @api_client.config.client_side_validation && project_key.nil?
56
+ fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentReleasePlansBetaApi.delete_default_environment_release_plan"
57
+ end
58
+ # verify the required parameter 'environment_key' is set
59
+ if @api_client.config.client_side_validation && environment_key.nil?
60
+ fail ArgumentError, "Missing the required parameter 'environment_key' when calling EnvironmentReleasePlansBetaApi.delete_default_environment_release_plan"
61
+ end
62
+ # resource path
63
+ local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s))
64
+
65
+ # query parameters
66
+ query_params = opts[:query_params] || {}
67
+
68
+ # header parameters
69
+ header_params = opts[:header_params] || {}
70
+ # HTTP header 'Accept' (if needed)
71
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
72
+ header_params[:'LD-API-Version'] = ld_api_version
73
+
74
+ # form parameters
75
+ form_params = opts[:form_params] || {}
76
+
77
+ # http body (model)
78
+ post_body = opts[:debug_body]
79
+
80
+ # return_type
81
+ return_type = opts[:debug_return_type]
82
+
83
+ # auth_names
84
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
85
+
86
+ new_options = opts.merge(
87
+ :operation => :"EnvironmentReleasePlansBetaApi.delete_default_environment_release_plan",
88
+ :header_params => header_params,
89
+ :query_params => query_params,
90
+ :form_params => form_params,
91
+ :body => post_body,
92
+ :auth_names => auth_names,
93
+ :return_type => return_type
94
+ )
95
+
96
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
97
+ if @api_client.config.debugging
98
+ @api_client.config.logger.debug "API called: EnvironmentReleasePlansBetaApi#delete_default_environment_release_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
99
+ end
100
+ return data, status_code, headers
101
+ end
102
+
103
+ # Delete a release plan
104
+ # Delete a release plan by its key. The plan no longer appears in reads, and its key becomes available for reuse by a new plan. Returns 409 while a flag release plan still uses the release plan; remove it from those flag release plans first.
105
+ # @param ld_api_version [String] Version of the endpoint.
106
+ # @param project_key [String] The project key
107
+ # @param environment_key [String] The environment key
108
+ # @param release_plan_key [String] The release plan key
109
+ # @param [Hash] opts the optional parameters
110
+ # @return [nil]
111
+ def delete_environment_release_plan(ld_api_version, project_key, environment_key, release_plan_key, opts = {})
112
+ delete_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, release_plan_key, opts)
113
+ nil
114
+ end
115
+
116
+ # Delete a release plan
117
+ # Delete a release plan by its key. The plan no longer appears in reads, and its key becomes available for reuse by a new plan. Returns 409 while a flag release plan still uses the release plan; remove it from those flag release plans first.
118
+ # @param ld_api_version [String] Version of the endpoint.
119
+ # @param project_key [String] The project key
120
+ # @param environment_key [String] The environment key
121
+ # @param release_plan_key [String] The release plan key
122
+ # @param [Hash] opts the optional parameters
123
+ # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
124
+ def delete_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, release_plan_key, opts = {})
125
+ if @api_client.config.debugging
126
+ @api_client.config.logger.debug 'Calling API: EnvironmentReleasePlansBetaApi.delete_environment_release_plan ...'
127
+ end
128
+ # verify the required parameter 'ld_api_version' is set
129
+ if @api_client.config.client_side_validation && ld_api_version.nil?
130
+ fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling EnvironmentReleasePlansBetaApi.delete_environment_release_plan"
131
+ end
132
+ # verify enum value
133
+ allowable_values = ["beta"]
134
+ if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
135
+ fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
136
+ end
137
+ # verify the required parameter 'project_key' is set
138
+ if @api_client.config.client_side_validation && project_key.nil?
139
+ fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentReleasePlansBetaApi.delete_environment_release_plan"
140
+ end
141
+ # verify the required parameter 'environment_key' is set
142
+ if @api_client.config.client_side_validation && environment_key.nil?
143
+ fail ArgumentError, "Missing the required parameter 'environment_key' when calling EnvironmentReleasePlansBetaApi.delete_environment_release_plan"
144
+ end
145
+ # verify the required parameter 'release_plan_key' is set
146
+ if @api_client.config.client_side_validation && release_plan_key.nil?
147
+ fail ArgumentError, "Missing the required parameter 'release_plan_key' when calling EnvironmentReleasePlansBetaApi.delete_environment_release_plan"
148
+ end
149
+ # resource path
150
+ local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/release-plans/{releasePlanKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'releasePlanKey' + '}', CGI.escape(release_plan_key.to_s))
151
+
152
+ # query parameters
153
+ query_params = opts[:query_params] || {}
154
+
155
+ # header parameters
156
+ header_params = opts[:header_params] || {}
157
+ # HTTP header 'Accept' (if needed)
158
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
159
+ header_params[:'LD-API-Version'] = ld_api_version
160
+
161
+ # form parameters
162
+ form_params = opts[:form_params] || {}
163
+
164
+ # http body (model)
165
+ post_body = opts[:debug_body]
166
+
167
+ # return_type
168
+ return_type = opts[:debug_return_type]
169
+
170
+ # auth_names
171
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
172
+
173
+ new_options = opts.merge(
174
+ :operation => :"EnvironmentReleasePlansBetaApi.delete_environment_release_plan",
175
+ :header_params => header_params,
176
+ :query_params => query_params,
177
+ :form_params => form_params,
178
+ :body => post_body,
179
+ :auth_names => auth_names,
180
+ :return_type => return_type
181
+ )
182
+
183
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
184
+ if @api_client.config.debugging
185
+ @api_client.config.logger.debug "API called: EnvironmentReleasePlansBetaApi#delete_environment_release_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
186
+ end
187
+ return data, status_code, headers
188
+ end
189
+
190
+ # Get the default release plan
191
+ # Get the environment's default release plan — the plan consumers preselect when starting a release. Returns `204 No Content` when the environment has no default.
192
+ # @param ld_api_version [String] Version of the endpoint.
193
+ # @param project_key [String] The project key
194
+ # @param environment_key [String] The environment key
195
+ # @param [Hash] opts the optional parameters
196
+ # @return [EnvironmentReleasePlan]
197
+ def get_default_environment_release_plan(ld_api_version, project_key, environment_key, opts = {})
198
+ data, _status_code, _headers = get_default_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, opts)
199
+ data
200
+ end
201
+
202
+ # Get the default release plan
203
+ # Get the environment&#39;s default release plan — the plan consumers preselect when starting a release. Returns &#x60;204 No Content&#x60; when the environment has no default.
204
+ # @param ld_api_version [String] Version of the endpoint.
205
+ # @param project_key [String] The project key
206
+ # @param environment_key [String] The environment key
207
+ # @param [Hash] opts the optional parameters
208
+ # @return [Array<(EnvironmentReleasePlan, Integer, Hash)>] EnvironmentReleasePlan data, response status code and response headers
209
+ def get_default_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, opts = {})
210
+ if @api_client.config.debugging
211
+ @api_client.config.logger.debug 'Calling API: EnvironmentReleasePlansBetaApi.get_default_environment_release_plan ...'
212
+ end
213
+ # verify the required parameter 'ld_api_version' is set
214
+ if @api_client.config.client_side_validation && ld_api_version.nil?
215
+ fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling EnvironmentReleasePlansBetaApi.get_default_environment_release_plan"
216
+ end
217
+ # verify enum value
218
+ allowable_values = ["beta"]
219
+ if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
220
+ fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
221
+ end
222
+ # verify the required parameter 'project_key' is set
223
+ if @api_client.config.client_side_validation && project_key.nil?
224
+ fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentReleasePlansBetaApi.get_default_environment_release_plan"
225
+ end
226
+ # verify the required parameter 'environment_key' is set
227
+ if @api_client.config.client_side_validation && environment_key.nil?
228
+ fail ArgumentError, "Missing the required parameter 'environment_key' when calling EnvironmentReleasePlansBetaApi.get_default_environment_release_plan"
229
+ end
230
+ # resource path
231
+ local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s))
232
+
233
+ # query parameters
234
+ query_params = opts[:query_params] || {}
235
+
236
+ # header parameters
237
+ header_params = opts[:header_params] || {}
238
+ # HTTP header 'Accept' (if needed)
239
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
240
+ header_params[:'LD-API-Version'] = ld_api_version
241
+
242
+ # form parameters
243
+ form_params = opts[:form_params] || {}
244
+
245
+ # http body (model)
246
+ post_body = opts[:debug_body]
247
+
248
+ # return_type
249
+ return_type = opts[:debug_return_type] || 'EnvironmentReleasePlan'
250
+
251
+ # auth_names
252
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
253
+
254
+ new_options = opts.merge(
255
+ :operation => :"EnvironmentReleasePlansBetaApi.get_default_environment_release_plan",
256
+ :header_params => header_params,
257
+ :query_params => query_params,
258
+ :form_params => form_params,
259
+ :body => post_body,
260
+ :auth_names => auth_names,
261
+ :return_type => return_type
262
+ )
263
+
264
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
265
+ if @api_client.config.debugging
266
+ @api_client.config.logger.debug "API called: EnvironmentReleasePlansBetaApi#get_default_environment_release_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
267
+ end
268
+ return data, status_code, headers
269
+ end
270
+
271
+ # Get a release plan
272
+ # Get a single release plan by its key.
273
+ # @param ld_api_version [String] Version of the endpoint.
274
+ # @param project_key [String] The project key
275
+ # @param environment_key [String] The environment key
276
+ # @param release_plan_key [String] The release plan key
277
+ # @param [Hash] opts the optional parameters
278
+ # @return [EnvironmentReleasePlan]
279
+ def get_environment_release_plan(ld_api_version, project_key, environment_key, release_plan_key, opts = {})
280
+ data, _status_code, _headers = get_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, release_plan_key, opts)
281
+ data
282
+ end
283
+
284
+ # Get a release plan
285
+ # Get a single release plan by its key.
286
+ # @param ld_api_version [String] Version of the endpoint.
287
+ # @param project_key [String] The project key
288
+ # @param environment_key [String] The environment key
289
+ # @param release_plan_key [String] The release plan key
290
+ # @param [Hash] opts the optional parameters
291
+ # @return [Array<(EnvironmentReleasePlan, Integer, Hash)>] EnvironmentReleasePlan data, response status code and response headers
292
+ def get_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, release_plan_key, opts = {})
293
+ if @api_client.config.debugging
294
+ @api_client.config.logger.debug 'Calling API: EnvironmentReleasePlansBetaApi.get_environment_release_plan ...'
295
+ end
296
+ # verify the required parameter 'ld_api_version' is set
297
+ if @api_client.config.client_side_validation && ld_api_version.nil?
298
+ fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling EnvironmentReleasePlansBetaApi.get_environment_release_plan"
299
+ end
300
+ # verify enum value
301
+ allowable_values = ["beta"]
302
+ if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
303
+ fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
304
+ end
305
+ # verify the required parameter 'project_key' is set
306
+ if @api_client.config.client_side_validation && project_key.nil?
307
+ fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentReleasePlansBetaApi.get_environment_release_plan"
308
+ end
309
+ # verify the required parameter 'environment_key' is set
310
+ if @api_client.config.client_side_validation && environment_key.nil?
311
+ fail ArgumentError, "Missing the required parameter 'environment_key' when calling EnvironmentReleasePlansBetaApi.get_environment_release_plan"
312
+ end
313
+ # verify the required parameter 'release_plan_key' is set
314
+ if @api_client.config.client_side_validation && release_plan_key.nil?
315
+ fail ArgumentError, "Missing the required parameter 'release_plan_key' when calling EnvironmentReleasePlansBetaApi.get_environment_release_plan"
316
+ end
317
+ # resource path
318
+ local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/release-plans/{releasePlanKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'releasePlanKey' + '}', CGI.escape(release_plan_key.to_s))
319
+
320
+ # query parameters
321
+ query_params = opts[:query_params] || {}
322
+
323
+ # header parameters
324
+ header_params = opts[:header_params] || {}
325
+ # HTTP header 'Accept' (if needed)
326
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
327
+ header_params[:'LD-API-Version'] = ld_api_version
328
+
329
+ # form parameters
330
+ form_params = opts[:form_params] || {}
331
+
332
+ # http body (model)
333
+ post_body = opts[:debug_body]
334
+
335
+ # return_type
336
+ return_type = opts[:debug_return_type] || 'EnvironmentReleasePlan'
337
+
338
+ # auth_names
339
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
340
+
341
+ new_options = opts.merge(
342
+ :operation => :"EnvironmentReleasePlansBetaApi.get_environment_release_plan",
343
+ :header_params => header_params,
344
+ :query_params => query_params,
345
+ :form_params => form_params,
346
+ :body => post_body,
347
+ :auth_names => auth_names,
348
+ :return_type => return_type
349
+ )
350
+
351
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
352
+ if @api_client.config.debugging
353
+ @api_client.config.logger.debug "API called: EnvironmentReleasePlansBetaApi#get_environment_release_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
354
+ end
355
+ return data, status_code, headers
356
+ end
357
+
358
+ # List release plans
359
+ # Get the environment's release plans, ordered by creation time.
360
+ # @param ld_api_version [String] Version of the endpoint.
361
+ # @param project_key [String] The project key
362
+ # @param environment_key [String] The environment key
363
+ # @param [Hash] opts the optional parameters
364
+ # @option opts [String] :filter A queryfilter expression that narrows the list by text match. Supported field and operators: &#x60;query&#x60; (&#x60;equals&#x60;, &#x60;contains&#x60;). When present, only release plans whose name or key contains the text, case-insensitively, are returned, and totalCount counts the matches. Surrounding whitespace is ignored, and the text is at most 256 bytes. Omitting the filter lists every release plan in the environment.
365
+ # @option opts [Integer] :limit The number of release plans to return. Defaults to 20. Maximum is 100.
366
+ # @option opts [Integer] :offset The number of release plans to skip. Used for pagination.
367
+ # @return [EnvironmentReleasePlans]
368
+ def get_environment_release_plans(ld_api_version, project_key, environment_key, opts = {})
369
+ data, _status_code, _headers = get_environment_release_plans_with_http_info(ld_api_version, project_key, environment_key, opts)
370
+ data
371
+ end
372
+
373
+ # List release plans
374
+ # Get the environment&#39;s release plans, ordered by creation time.
375
+ # @param ld_api_version [String] Version of the endpoint.
376
+ # @param project_key [String] The project key
377
+ # @param environment_key [String] The environment key
378
+ # @param [Hash] opts the optional parameters
379
+ # @option opts [String] :filter A queryfilter expression that narrows the list by text match. Supported field and operators: &#x60;query&#x60; (&#x60;equals&#x60;, &#x60;contains&#x60;). When present, only release plans whose name or key contains the text, case-insensitively, are returned, and totalCount counts the matches. Surrounding whitespace is ignored, and the text is at most 256 bytes. Omitting the filter lists every release plan in the environment.
380
+ # @option opts [Integer] :limit The number of release plans to return. Defaults to 20. Maximum is 100.
381
+ # @option opts [Integer] :offset The number of release plans to skip. Used for pagination.
382
+ # @return [Array<(EnvironmentReleasePlans, Integer, Hash)>] EnvironmentReleasePlans data, response status code and response headers
383
+ def get_environment_release_plans_with_http_info(ld_api_version, project_key, environment_key, opts = {})
384
+ if @api_client.config.debugging
385
+ @api_client.config.logger.debug 'Calling API: EnvironmentReleasePlansBetaApi.get_environment_release_plans ...'
386
+ end
387
+ # verify the required parameter 'ld_api_version' is set
388
+ if @api_client.config.client_side_validation && ld_api_version.nil?
389
+ fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling EnvironmentReleasePlansBetaApi.get_environment_release_plans"
390
+ end
391
+ # verify enum value
392
+ allowable_values = ["beta"]
393
+ if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
394
+ fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
395
+ end
396
+ # verify the required parameter 'project_key' is set
397
+ if @api_client.config.client_side_validation && project_key.nil?
398
+ fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentReleasePlansBetaApi.get_environment_release_plans"
399
+ end
400
+ # verify the required parameter 'environment_key' is set
401
+ if @api_client.config.client_side_validation && environment_key.nil?
402
+ fail ArgumentError, "Missing the required parameter 'environment_key' when calling EnvironmentReleasePlansBetaApi.get_environment_release_plans"
403
+ end
404
+ # resource path
405
+ local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/release-plans'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s))
406
+
407
+ # query parameters
408
+ query_params = opts[:query_params] || {}
409
+ query_params[:'filter'] = opts[:'filter'] if !opts[:'filter'].nil?
410
+ query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
411
+ query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?
412
+
413
+ # header parameters
414
+ header_params = opts[:header_params] || {}
415
+ # HTTP header 'Accept' (if needed)
416
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
417
+ header_params[:'LD-API-Version'] = ld_api_version
418
+
419
+ # form parameters
420
+ form_params = opts[:form_params] || {}
421
+
422
+ # http body (model)
423
+ post_body = opts[:debug_body]
424
+
425
+ # return_type
426
+ return_type = opts[:debug_return_type] || 'EnvironmentReleasePlans'
427
+
428
+ # auth_names
429
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
430
+
431
+ new_options = opts.merge(
432
+ :operation => :"EnvironmentReleasePlansBetaApi.get_environment_release_plans",
433
+ :header_params => header_params,
434
+ :query_params => query_params,
435
+ :form_params => form_params,
436
+ :body => post_body,
437
+ :auth_names => auth_names,
438
+ :return_type => return_type
439
+ )
440
+
441
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
442
+ if @api_client.config.debugging
443
+ @api_client.config.logger.debug "API called: EnvironmentReleasePlansBetaApi#get_environment_release_plans\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
444
+ end
445
+ return data, status_code, headers
446
+ end
447
+
448
+ # Create a release plan
449
+ # Create a new release plan for the specified environment.
450
+ # @param ld_api_version [String] Version of the endpoint.
451
+ # @param project_key [String] The project key
452
+ # @param environment_key [String] The environment key
453
+ # @param post_environment_release_plan_request [PostEnvironmentReleasePlanRequest] Release plan to create
454
+ # @param [Hash] opts the optional parameters
455
+ # @return [EnvironmentReleasePlan]
456
+ def post_environment_release_plan(ld_api_version, project_key, environment_key, post_environment_release_plan_request, opts = {})
457
+ data, _status_code, _headers = post_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, post_environment_release_plan_request, opts)
458
+ data
459
+ end
460
+
461
+ # Create a release plan
462
+ # Create a new release plan for the specified environment.
463
+ # @param ld_api_version [String] Version of the endpoint.
464
+ # @param project_key [String] The project key
465
+ # @param environment_key [String] The environment key
466
+ # @param post_environment_release_plan_request [PostEnvironmentReleasePlanRequest] Release plan to create
467
+ # @param [Hash] opts the optional parameters
468
+ # @return [Array<(EnvironmentReleasePlan, Integer, Hash)>] EnvironmentReleasePlan data, response status code and response headers
469
+ def post_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, post_environment_release_plan_request, opts = {})
470
+ if @api_client.config.debugging
471
+ @api_client.config.logger.debug 'Calling API: EnvironmentReleasePlansBetaApi.post_environment_release_plan ...'
472
+ end
473
+ # verify the required parameter 'ld_api_version' is set
474
+ if @api_client.config.client_side_validation && ld_api_version.nil?
475
+ fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling EnvironmentReleasePlansBetaApi.post_environment_release_plan"
476
+ end
477
+ # verify enum value
478
+ allowable_values = ["beta"]
479
+ if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
480
+ fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
481
+ end
482
+ # verify the required parameter 'project_key' is set
483
+ if @api_client.config.client_side_validation && project_key.nil?
484
+ fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentReleasePlansBetaApi.post_environment_release_plan"
485
+ end
486
+ # verify the required parameter 'environment_key' is set
487
+ if @api_client.config.client_side_validation && environment_key.nil?
488
+ fail ArgumentError, "Missing the required parameter 'environment_key' when calling EnvironmentReleasePlansBetaApi.post_environment_release_plan"
489
+ end
490
+ # verify the required parameter 'post_environment_release_plan_request' is set
491
+ if @api_client.config.client_side_validation && post_environment_release_plan_request.nil?
492
+ fail ArgumentError, "Missing the required parameter 'post_environment_release_plan_request' when calling EnvironmentReleasePlansBetaApi.post_environment_release_plan"
493
+ end
494
+ # resource path
495
+ local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/release-plans'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s))
496
+
497
+ # query parameters
498
+ query_params = opts[:query_params] || {}
499
+
500
+ # header parameters
501
+ header_params = opts[:header_params] || {}
502
+ # HTTP header 'Accept' (if needed)
503
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
504
+ # HTTP header 'Content-Type'
505
+ content_type = @api_client.select_header_content_type(['application/json'])
506
+ if !content_type.nil?
507
+ header_params['Content-Type'] = content_type
508
+ end
509
+ header_params[:'LD-API-Version'] = ld_api_version
510
+
511
+ # form parameters
512
+ form_params = opts[:form_params] || {}
513
+
514
+ # http body (model)
515
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(post_environment_release_plan_request)
516
+
517
+ # return_type
518
+ return_type = opts[:debug_return_type] || 'EnvironmentReleasePlan'
519
+
520
+ # auth_names
521
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
522
+
523
+ new_options = opts.merge(
524
+ :operation => :"EnvironmentReleasePlansBetaApi.post_environment_release_plan",
525
+ :header_params => header_params,
526
+ :query_params => query_params,
527
+ :form_params => form_params,
528
+ :body => post_body,
529
+ :auth_names => auth_names,
530
+ :return_type => return_type
531
+ )
532
+
533
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
534
+ if @api_client.config.debugging
535
+ @api_client.config.logger.debug "API called: EnvironmentReleasePlansBetaApi#post_environment_release_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
536
+ end
537
+ return data, status_code, headers
538
+ end
539
+
540
+ # Set the default release plan
541
+ # Set the plan with the given key as the environment's default, atomically replacing whatever was default before. Each plan whose default flag changes has its version incremented by 1. Idempotent: setting the current default again changes nothing. Rejects a key that is not an active plan in the environment, or a plan that has no randomization unit.
542
+ # @param ld_api_version [String] Version of the endpoint.
543
+ # @param project_key [String] The project key
544
+ # @param environment_key [String] The environment key
545
+ # @param put_default_environment_release_plan_request [PutDefaultEnvironmentReleasePlanRequest] The plan to set as the environment&#39;s default
546
+ # @param [Hash] opts the optional parameters
547
+ # @return [EnvironmentReleasePlan]
548
+ def put_default_environment_release_plan(ld_api_version, project_key, environment_key, put_default_environment_release_plan_request, opts = {})
549
+ data, _status_code, _headers = put_default_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, put_default_environment_release_plan_request, opts)
550
+ data
551
+ end
552
+
553
+ # Set the default release plan
554
+ # Set the plan with the given key as the environment&#39;s default, atomically replacing whatever was default before. Each plan whose default flag changes has its version incremented by 1. Idempotent: setting the current default again changes nothing. Rejects a key that is not an active plan in the environment, or a plan that has no randomization unit.
555
+ # @param ld_api_version [String] Version of the endpoint.
556
+ # @param project_key [String] The project key
557
+ # @param environment_key [String] The environment key
558
+ # @param put_default_environment_release_plan_request [PutDefaultEnvironmentReleasePlanRequest] The plan to set as the environment&#39;s default
559
+ # @param [Hash] opts the optional parameters
560
+ # @return [Array<(EnvironmentReleasePlan, Integer, Hash)>] EnvironmentReleasePlan data, response status code and response headers
561
+ def put_default_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, put_default_environment_release_plan_request, opts = {})
562
+ if @api_client.config.debugging
563
+ @api_client.config.logger.debug 'Calling API: EnvironmentReleasePlansBetaApi.put_default_environment_release_plan ...'
564
+ end
565
+ # verify the required parameter 'ld_api_version' is set
566
+ if @api_client.config.client_side_validation && ld_api_version.nil?
567
+ fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling EnvironmentReleasePlansBetaApi.put_default_environment_release_plan"
568
+ end
569
+ # verify enum value
570
+ allowable_values = ["beta"]
571
+ if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
572
+ fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
573
+ end
574
+ # verify the required parameter 'project_key' is set
575
+ if @api_client.config.client_side_validation && project_key.nil?
576
+ fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentReleasePlansBetaApi.put_default_environment_release_plan"
577
+ end
578
+ # verify the required parameter 'environment_key' is set
579
+ if @api_client.config.client_side_validation && environment_key.nil?
580
+ fail ArgumentError, "Missing the required parameter 'environment_key' when calling EnvironmentReleasePlansBetaApi.put_default_environment_release_plan"
581
+ end
582
+ # verify the required parameter 'put_default_environment_release_plan_request' is set
583
+ if @api_client.config.client_side_validation && put_default_environment_release_plan_request.nil?
584
+ fail ArgumentError, "Missing the required parameter 'put_default_environment_release_plan_request' when calling EnvironmentReleasePlansBetaApi.put_default_environment_release_plan"
585
+ end
586
+ # resource path
587
+ local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/default-release-plan'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s))
588
+
589
+ # query parameters
590
+ query_params = opts[:query_params] || {}
591
+
592
+ # header parameters
593
+ header_params = opts[:header_params] || {}
594
+ # HTTP header 'Accept' (if needed)
595
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
596
+ # HTTP header 'Content-Type'
597
+ content_type = @api_client.select_header_content_type(['application/json'])
598
+ if !content_type.nil?
599
+ header_params['Content-Type'] = content_type
600
+ end
601
+ header_params[:'LD-API-Version'] = ld_api_version
602
+
603
+ # form parameters
604
+ form_params = opts[:form_params] || {}
605
+
606
+ # http body (model)
607
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(put_default_environment_release_plan_request)
608
+
609
+ # return_type
610
+ return_type = opts[:debug_return_type] || 'EnvironmentReleasePlan'
611
+
612
+ # auth_names
613
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
614
+
615
+ new_options = opts.merge(
616
+ :operation => :"EnvironmentReleasePlansBetaApi.put_default_environment_release_plan",
617
+ :header_params => header_params,
618
+ :query_params => query_params,
619
+ :form_params => form_params,
620
+ :body => post_body,
621
+ :auth_names => auth_names,
622
+ :return_type => return_type
623
+ )
624
+
625
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
626
+ if @api_client.config.debugging
627
+ @api_client.config.logger.debug "API called: EnvironmentReleasePlansBetaApi#put_default_environment_release_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
628
+ end
629
+ return data, status_code, headers
630
+ end
631
+
632
+ # Update a release plan
633
+ # Replace a release plan's configuration. This is a full replace, not a merge: the plan's phases, steps, clauses, and metrics become exactly what the request specifies, and anything omitted is removed. The plan's key and environment are immutable, and its version increments by 1 on every successful update. The request's version is an optional optimistic lock: when present it must match the plan's current version, and on mismatch the request is rejected with 409 and no changes are applied, meaning the plan was edited since it was read; get the plan again and retry with its current version. When omitted the update applies unconditionally to the plan currently holding the key. A release already started from the plan is not affected.
634
+ # @param ld_api_version [String] Version of the endpoint.
635
+ # @param project_key [String] The project key
636
+ # @param environment_key [String] The environment key
637
+ # @param release_plan_key [String] The release plan key
638
+ # @param put_environment_release_plan_request [PutEnvironmentReleasePlanRequest] The release plan&#39;s replacement configuration
639
+ # @param [Hash] opts the optional parameters
640
+ # @return [EnvironmentReleasePlan]
641
+ def put_environment_release_plan(ld_api_version, project_key, environment_key, release_plan_key, put_environment_release_plan_request, opts = {})
642
+ data, _status_code, _headers = put_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, release_plan_key, put_environment_release_plan_request, opts)
643
+ data
644
+ end
645
+
646
+ # Update a release plan
647
+ # Replace a release plan&#39;s configuration. This is a full replace, not a merge: the plan&#39;s phases, steps, clauses, and metrics become exactly what the request specifies, and anything omitted is removed. The plan&#39;s key and environment are immutable, and its version increments by 1 on every successful update. The request&#39;s version is an optional optimistic lock: when present it must match the plan&#39;s current version, and on mismatch the request is rejected with 409 and no changes are applied, meaning the plan was edited since it was read; get the plan again and retry with its current version. When omitted the update applies unconditionally to the plan currently holding the key. A release already started from the plan is not affected.
648
+ # @param ld_api_version [String] Version of the endpoint.
649
+ # @param project_key [String] The project key
650
+ # @param environment_key [String] The environment key
651
+ # @param release_plan_key [String] The release plan key
652
+ # @param put_environment_release_plan_request [PutEnvironmentReleasePlanRequest] The release plan&#39;s replacement configuration
653
+ # @param [Hash] opts the optional parameters
654
+ # @return [Array<(EnvironmentReleasePlan, Integer, Hash)>] EnvironmentReleasePlan data, response status code and response headers
655
+ def put_environment_release_plan_with_http_info(ld_api_version, project_key, environment_key, release_plan_key, put_environment_release_plan_request, opts = {})
656
+ if @api_client.config.debugging
657
+ @api_client.config.logger.debug 'Calling API: EnvironmentReleasePlansBetaApi.put_environment_release_plan ...'
658
+ end
659
+ # verify the required parameter 'ld_api_version' is set
660
+ if @api_client.config.client_side_validation && ld_api_version.nil?
661
+ fail ArgumentError, "Missing the required parameter 'ld_api_version' when calling EnvironmentReleasePlansBetaApi.put_environment_release_plan"
662
+ end
663
+ # verify enum value
664
+ allowable_values = ["beta"]
665
+ if @api_client.config.client_side_validation && !allowable_values.include?(ld_api_version)
666
+ fail ArgumentError, "invalid value for \"ld_api_version\", must be one of #{allowable_values}"
667
+ end
668
+ # verify the required parameter 'project_key' is set
669
+ if @api_client.config.client_side_validation && project_key.nil?
670
+ fail ArgumentError, "Missing the required parameter 'project_key' when calling EnvironmentReleasePlansBetaApi.put_environment_release_plan"
671
+ end
672
+ # verify the required parameter 'environment_key' is set
673
+ if @api_client.config.client_side_validation && environment_key.nil?
674
+ fail ArgumentError, "Missing the required parameter 'environment_key' when calling EnvironmentReleasePlansBetaApi.put_environment_release_plan"
675
+ end
676
+ # verify the required parameter 'release_plan_key' is set
677
+ if @api_client.config.client_side_validation && release_plan_key.nil?
678
+ fail ArgumentError, "Missing the required parameter 'release_plan_key' when calling EnvironmentReleasePlansBetaApi.put_environment_release_plan"
679
+ end
680
+ # verify the required parameter 'put_environment_release_plan_request' is set
681
+ if @api_client.config.client_side_validation && put_environment_release_plan_request.nil?
682
+ fail ArgumentError, "Missing the required parameter 'put_environment_release_plan_request' when calling EnvironmentReleasePlansBetaApi.put_environment_release_plan"
683
+ end
684
+ # resource path
685
+ local_var_path = '/api/v2/projects/{projectKey}/environments/{environmentKey}/release-plans/{releasePlanKey}'.sub('{' + 'projectKey' + '}', CGI.escape(project_key.to_s)).sub('{' + 'environmentKey' + '}', CGI.escape(environment_key.to_s)).sub('{' + 'releasePlanKey' + '}', CGI.escape(release_plan_key.to_s))
686
+
687
+ # query parameters
688
+ query_params = opts[:query_params] || {}
689
+
690
+ # header parameters
691
+ header_params = opts[:header_params] || {}
692
+ # HTTP header 'Accept' (if needed)
693
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
694
+ # HTTP header 'Content-Type'
695
+ content_type = @api_client.select_header_content_type(['application/json'])
696
+ if !content_type.nil?
697
+ header_params['Content-Type'] = content_type
698
+ end
699
+ header_params[:'LD-API-Version'] = ld_api_version
700
+
701
+ # form parameters
702
+ form_params = opts[:form_params] || {}
703
+
704
+ # http body (model)
705
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(put_environment_release_plan_request)
706
+
707
+ # return_type
708
+ return_type = opts[:debug_return_type] || 'EnvironmentReleasePlan'
709
+
710
+ # auth_names
711
+ auth_names = opts[:debug_auth_names] || ['ApiKey']
712
+
713
+ new_options = opts.merge(
714
+ :operation => :"EnvironmentReleasePlansBetaApi.put_environment_release_plan",
715
+ :header_params => header_params,
716
+ :query_params => query_params,
717
+ :form_params => form_params,
718
+ :body => post_body,
719
+ :auth_names => auth_names,
720
+ :return_type => return_type
721
+ )
722
+
723
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
724
+ if @api_client.config.debugging
725
+ @api_client.config.logger.debug "API called: EnvironmentReleasePlansBetaApi#put_environment_release_plan\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
726
+ end
727
+ return data, status_code, headers
728
+ end
729
+ end
730
+ end