Skip to content

Latest commit

 

History

History
494 lines (370 loc) · 19.8 KB

FlagTriggersApi.md

File metadata and controls

494 lines (370 loc) · 19.8 KB

launchdarkly_api.FlagTriggersApi

All URIs are relative to https://app.launchdarkly.com

Method HTTP request Description
create_trigger_workflow POST /api/v2/flags/{projectKey}/{featureFlagKey}/triggers/{environmentKey} Create flag trigger
delete_trigger_workflow DELETE /api/v2/flags/{projectKey}/{featureFlagKey}/triggers/{environmentKey}/{id} Delete flag trigger
get_trigger_workflow_by_id GET /api/v2/flags/{projectKey}/{featureFlagKey}/triggers/{environmentKey}/{id} Get flag trigger by ID
get_trigger_workflows GET /api/v2/flags/{projectKey}/{featureFlagKey}/triggers/{environmentKey} List flag triggers
patch_trigger_workflow PATCH /api/v2/flags/{projectKey}/{featureFlagKey}/triggers/{environmentKey}/{id} Update flag trigger

create_trigger_workflow

TriggerWorkflowRep create_trigger_workflow(project_key, environment_key, feature_flag_key, trigger_post)

Create flag trigger

Create a new flag trigger.

Example

  • Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import flag_triggers_api
from launchdarkly_api.model.trigger_post import TriggerPost
from launchdarkly_api.model.invalid_request_error_rep import InvalidRequestErrorRep
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.trigger_workflow_rep import TriggerWorkflowRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
    host = "https://app.launchdarkly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = flag_triggers_api.FlagTriggersApi(api_client)
    project_key = "projectKey_example" # str | The project key
    environment_key = "environmentKey_example" # str | The environment key
    feature_flag_key = "featureFlagKey_example" # str | The feature flag key
    trigger_post = TriggerPost(
        comment="example comment",
        instructions=[
            Instruction(
                key=None,
            ),
        ],
        integration_key="generic-trigger",
    ) # TriggerPost | 

    # example passing only required values which don't have defaults set
    try:
        # Create flag trigger
        api_response = api_instance.create_trigger_workflow(project_key, environment_key, feature_flag_key, trigger_post)
        pprint(api_response)
    except launchdarkly_api.ApiException as e:
        print("Exception when calling FlagTriggersApi->create_trigger_workflow: %s\n" % e)

Parameters

Name Type Description Notes
project_key str The project key
environment_key str The environment key
feature_flag_key str The feature flag key
trigger_post TriggerPost

Return type

TriggerWorkflowRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
201 Flag trigger response -
400 Invalid request -
401 Invalid access token -
403 Forbidden -
404 Invalid resource identifier -
429 Rate limited -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

delete_trigger_workflow

delete_trigger_workflow(project_key, environment_key, feature_flag_key, id)

Delete flag trigger

Delete a flag trigger by ID.

Example

  • Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import flag_triggers_api
from launchdarkly_api.model.invalid_request_error_rep import InvalidRequestErrorRep
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
    host = "https://app.launchdarkly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = flag_triggers_api.FlagTriggersApi(api_client)
    project_key = "projectKey_example" # str | The project key
    environment_key = "environmentKey_example" # str | The environment key
    feature_flag_key = "featureFlagKey_example" # str | The feature flag key
    id = "id_example" # str | The flag trigger ID

    # example passing only required values which don't have defaults set
    try:
        # Delete flag trigger
        api_instance.delete_trigger_workflow(project_key, environment_key, feature_flag_key, id)
    except launchdarkly_api.ApiException as e:
        print("Exception when calling FlagTriggersApi->delete_trigger_workflow: %s\n" % e)

Parameters

Name Type Description Notes
project_key str The project key
environment_key str The environment key
feature_flag_key str The feature flag key
id str The flag trigger ID

Return type

void (empty response body)

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
204 Action succeeded -
400 Invalid request -
401 Invalid access token -
403 Forbidden -
404 Invalid resource identifier -
429 Rate limited -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_trigger_workflow_by_id

TriggerWorkflowRep get_trigger_workflow_by_id(project_key, feature_flag_key, environment_key, id)

Get flag trigger by ID

Get a flag trigger by ID.

Example

  • Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import flag_triggers_api
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.trigger_workflow_rep import TriggerWorkflowRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
    host = "https://app.launchdarkly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = flag_triggers_api.FlagTriggersApi(api_client)
    project_key = "projectKey_example" # str | The project key
    feature_flag_key = "featureFlagKey_example" # str | The feature flag key
    environment_key = "environmentKey_example" # str | The environment key
    id = "id_example" # str | The flag trigger ID

    # example passing only required values which don't have defaults set
    try:
        # Get flag trigger by ID
        api_response = api_instance.get_trigger_workflow_by_id(project_key, feature_flag_key, environment_key, id)
        pprint(api_response)
    except launchdarkly_api.ApiException as e:
        print("Exception when calling FlagTriggersApi->get_trigger_workflow_by_id: %s\n" % e)

Parameters

Name Type Description Notes
project_key str The project key
feature_flag_key str The feature flag key
environment_key str The environment key
id str The flag trigger ID

Return type

TriggerWorkflowRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Flag trigger response -
401 Invalid access token -
403 Forbidden -
404 Invalid resource identifier -
429 Rate limited -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_trigger_workflows

TriggerWorkflowCollectionRep get_trigger_workflows(project_key, environment_key, feature_flag_key)

List flag triggers

Get a list of all flag triggers.

Example

  • Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import flag_triggers_api
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.trigger_workflow_collection_rep import TriggerWorkflowCollectionRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
    host = "https://app.launchdarkly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = flag_triggers_api.FlagTriggersApi(api_client)
    project_key = "projectKey_example" # str | The project key
    environment_key = "environmentKey_example" # str | The environment key
    feature_flag_key = "featureFlagKey_example" # str | The feature flag key

    # example passing only required values which don't have defaults set
    try:
        # List flag triggers
        api_response = api_instance.get_trigger_workflows(project_key, environment_key, feature_flag_key)
        pprint(api_response)
    except launchdarkly_api.ApiException as e:
        print("Exception when calling FlagTriggersApi->get_trigger_workflows: %s\n" % e)

Parameters

Name Type Description Notes
project_key str The project key
environment_key str The environment key
feature_flag_key str The feature flag key

Return type

TriggerWorkflowCollectionRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: Not defined
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Flag trigger collection response -
401 Invalid access token -
403 Forbidden -
429 Rate limited -

[Back to top] [Back to API list] [Back to Model list] [Back to README]

patch_trigger_workflow

TriggerWorkflowRep patch_trigger_workflow(project_key, environment_key, feature_flag_key, id, flag_trigger_input)

Update flag trigger

Update a flag trigger. Updating a flag trigger 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. ### Instructions Semantic patch requests support the following kind instructions for updating flag triggers.

Click to expand instructions for updating flag triggers #### replaceTriggerActionInstructions Removes the existing trigger action and replaces it with the new instructions. ##### Parameters - value: An array of the new kinds of actions to perform when triggering. Supported flag actions are turnFlagOn and turnFlagOff. Here's an example that replaces the existing action with new instructions to turn flag targeting off: json { \"instructions\": [ { \"kind\": \"replaceTriggerActionInstructions\", \"value\": [ {\"kind\": \"turnFlagOff\"} ] } ] } #### cycleTriggerUrl Generates a new URL for this trigger. You must update any clients using the trigger to use this new URL. Here's an example: json { \"instructions\": [{ \"kind\": \"cycleTriggerUrl\" }] } #### disableTrigger Disables the trigger. This saves the trigger configuration, but the trigger stops running. To re-enable, use enableTrigger. Here's an example: json { \"instructions\": [{ \"kind\": \"disableTrigger\" }] } #### enableTrigger Enables the trigger. If you previously disabled the trigger, it begins running again. Here's an example: json { \"instructions\": [{ \"kind\": \"enableTrigger\" }] }

Example

  • Api Key Authentication (ApiKey):
import time
import launchdarkly_api
from launchdarkly_api.api import flag_triggers_api
from launchdarkly_api.model.invalid_request_error_rep import InvalidRequestErrorRep
from launchdarkly_api.model.forbidden_error_rep import ForbiddenErrorRep
from launchdarkly_api.model.not_found_error_rep import NotFoundErrorRep
from launchdarkly_api.model.trigger_workflow_rep import TriggerWorkflowRep
from launchdarkly_api.model.flag_trigger_input import FlagTriggerInput
from launchdarkly_api.model.rate_limited_error_rep import RateLimitedErrorRep
from launchdarkly_api.model.unauthorized_error_rep import UnauthorizedErrorRep
from launchdarkly_api.model.status_conflict_error_rep import StatusConflictErrorRep
from pprint import pprint
# Defining the host is optional and defaults to https://app.launchdarkly.com
# See configuration.py for a list of all supported configuration parameters.
configuration = launchdarkly_api.Configuration(
    host = "https://app.launchdarkly.com"
)

# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.

# Configure API key authorization: ApiKey
configuration.api_key['ApiKey'] = 'YOUR_API_KEY'

# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['ApiKey'] = 'Bearer'

# Enter a context with an instance of the API client
with launchdarkly_api.ApiClient(configuration) as api_client:
    # Create an instance of the API class
    api_instance = flag_triggers_api.FlagTriggersApi(api_client)
    project_key = "projectKey_example" # str | The project key
    environment_key = "environmentKey_example" # str | The environment key
    feature_flag_key = "featureFlagKey_example" # str | The feature flag key
    id = "id_example" # str | The flag trigger ID
    flag_trigger_input = FlagTriggerInput(
        comment="optional comment",
        instructions=[
            Instruction(
                key=None,
            ),
        ],
    ) # FlagTriggerInput | 

    # example passing only required values which don't have defaults set
    try:
        # Update flag trigger
        api_response = api_instance.patch_trigger_workflow(project_key, environment_key, feature_flag_key, id, flag_trigger_input)
        pprint(api_response)
    except launchdarkly_api.ApiException as e:
        print("Exception when calling FlagTriggersApi->patch_trigger_workflow: %s\n" % e)

Parameters

Name Type Description Notes
project_key str The project key
environment_key str The environment key
feature_flag_key str The feature flag key
id str The flag trigger ID
flag_trigger_input FlagTriggerInput

Return type

TriggerWorkflowRep

Authorization

ApiKey

HTTP request headers

  • Content-Type: application/json
  • Accept: application/json

HTTP response details

Status code Description Response headers
200 Flag trigger response -
400 Invalid request -
401 Invalid access token -
403 Forbidden -
404 Invalid resource identifier -
409 Status conflict -
429 Rate limited -

[Back to top] [Back to API list] [Back to Model list] [Back to README]