Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
131 changes: 131 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26762,6 +26762,9 @@ components:
description: "A sample workflow."
name: "Example Workflow"
published: true
runAs:
id: 00000000-0000-0000-0000-000000000007
type: service_account
spec:
annotations:
- display:
Expand Down Expand Up @@ -120857,6 +120860,9 @@ components:
description: "A sample workflow."
name: "Example Workflow"
published: true
runAs:
id: 00000000-0000-0000-0000-000000000007
type: service_account
spec:
annotations:
- display:
Expand Down Expand Up @@ -123940,6 +123946,12 @@ components:
published:
description: Set the workflow to published or unpublished. Workflows in an unpublished state will only be executable via manual runs. Automatic triggers such as Schedule will not execute the workflow until it is published.
type: boolean
runAs:
$ref: "#/components/schemas/WorkflowRunAs"
writeOnly: true
runAsUserMode:
$ref: "#/components/schemas/WorkflowRunAsUserMode"
readOnly: true
spec:
$ref: "#/components/schemas/Spec"
tags:
Expand Down Expand Up @@ -123968,6 +123980,9 @@ components:
$ref: "#/components/schemas/WorkflowUserRelationship"
owner:
$ref: "#/components/schemas/WorkflowUserRelationship"
runAs:
$ref: "#/components/schemas/WorkflowUserRelationship"
description: The service account used to run the workflow. Present when `runAsUserMode` is `service_account`.
readOnly: true
type: object
WorkflowDataType:
Expand Down Expand Up @@ -124011,6 +124026,12 @@ components:
published:
description: Set the workflow to published or unpublished. Workflows in an unpublished state will only be executable via manual runs. Automatic triggers such as Schedule will not execute the workflow until it is published.
type: boolean
runAs:
$ref: "#/components/schemas/WorkflowRunAs"
writeOnly: true
runAsUserMode:
$ref: "#/components/schemas/WorkflowRunAsUserMode"
readOnly: true
spec:
$ref: "#/components/schemas/Spec"
tags:
Expand Down Expand Up @@ -124129,6 +124150,9 @@ components:
published:
description: Whether the workflow is published. Unpublished workflows can only be run manually. Automatic triggers such as Schedule do not fire until the workflow is published.
type: boolean
runAsUserMode:
$ref: "#/components/schemas/WorkflowRunAsUserMode"
readOnly: true
spec:
$ref: "#/components/schemas/Spec"
nullable: true
Expand All @@ -124146,6 +124170,84 @@ components:
required:
- name
type: object
WorkflowRunAs:
description: Identity used to run the workflow.
example:
id: 00000000-0000-0000-0000-000000000007
type: service_account
oneOf:
- $ref: "#/components/schemas/WorkflowRunAsOwner"
- $ref: "#/components/schemas/WorkflowRunAsServiceAccount"
- $ref: "#/components/schemas/WorkflowRunAsInitiator"
WorkflowRunAsInitiator:
additionalProperties: false
description: Run the workflow as the user who initiates the execution.
properties:
type:
$ref: "#/components/schemas/WorkflowRunAsInitiatorType"
required:
- type
type: object
WorkflowRunAsInitiatorType:
description: The initiator run-as type.
enum:
- initiator
example: initiator
type: string
x-enum-varnames:
- INITIATOR
WorkflowRunAsOwner:
additionalProperties: false
description: Run the workflow as its owner.
properties:
type:
$ref: "#/components/schemas/WorkflowRunAsOwnerType"
required:
- type
type: object
WorkflowRunAsOwnerType:
description: The owner run-as type.
enum:
- owner
example: owner
type: string
x-enum-varnames:
- OWNER
WorkflowRunAsServiceAccount:
additionalProperties: false
description: Run the workflow as a service account.
properties:
id:
description: The service account identifier.
example: 00000000-0000-0000-0000-000000000007
format: uuid
type: string
type:
$ref: "#/components/schemas/WorkflowRunAsServiceAccountType"
required:
- type
- id
type: object
WorkflowRunAsServiceAccountType:
description: The service account run-as type.
enum:
- service_account
example: service_account
type: string
x-enum-varnames:
- SERVICE_ACCOUNT
WorkflowRunAsUserMode:
description: The effective type of identity used to run the workflow.
enum:
- owner
- service_account
- initiator
example: service_account
type: string
x-enum-varnames:
- OWNER
- SERVICE_ACCOUNT
- INITIATOR
WorkflowTriggerWrapper:
description: "Schema for a Workflow-based trigger."
properties:
Expand Down Expand Up @@ -220121,6 +220223,7 @@ paths:
description: A sample workflow.
name: Example Workflow
published: true
runAsUserMode: service_account
spec: {}
tags:
- team:infra
Expand All @@ -220135,6 +220238,10 @@ paths:
data:
id: 00000000-0000-0000-0000-000000000009
type: users
runAs:
data:
id: 00000000-0000-0000-0000-000000000007
type: users
type: workflows
meta:
page:
Expand Down Expand Up @@ -220175,6 +220282,9 @@ paths:
description: A sample workflow.
name: Example Workflow
published: true
runAs:
id: 00000000-0000-0000-0000-000000000007
type: service_account
spec:
annotations:
- display:
Expand Down Expand Up @@ -220241,8 +220351,14 @@ paths:
data:
attributes:
name: Example Workflow
runAsUserMode: service_account
spec: {}
id: 00000000-0000-0000-0000-000000000001
relationships:
runAs:
data:
id: 00000000-0000-0000-0000-000000000007
type: users
type: workflows
schema:
$ref: "#/components/schemas/CreateWorkflowResponse"
Expand Down Expand Up @@ -220324,11 +220440,17 @@ paths:
description: A sample workflow.
name: Example Workflow
published: true
runAsUserMode: service_account
spec: {}
tags:
- team:infra
updatedAt: "2024-01-01T00:00:00+00:00"
id: 00000000-0000-0000-0000-000000000002
relationships:
runAs:
data:
id: 00000000-0000-0000-0000-000000000007
type: users
type: workflows
schema:
$ref: "#/components/schemas/GetWorkflowResponse"
Expand Down Expand Up @@ -220380,6 +220502,9 @@ paths:
description: A sample workflow.
name: Example Workflow
published: true
runAs:
id: 00000000-0000-0000-0000-000000000007
type: service_account
spec:
annotations:
- display:
Expand Down Expand Up @@ -220447,7 +220572,13 @@ paths:
data:
attributes:
name: Example Workflow
runAsUserMode: service_account
id: 00000000-0000-0000-0000-000000000003
relationships:
runAs:
data:
id: 00000000-0000-0000-0000-000000000007
type: users
type: workflows
schema:
$ref: "#/components/schemas/UpdateWorkflowResponse"
Expand Down
10 changes: 10 additions & 0 deletions examples/v2/workflow-automation/CreateWorkflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Create a Workflow returns "Successfully created a workflow." response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.workflow_automation_api import WorkflowAutomationApi
from datadog_api_client.v2.model.connection import Connection
Expand All @@ -26,13 +27,22 @@
from datadog_api_client.v2.model.workflow_data import WorkflowData
from datadog_api_client.v2.model.workflow_data_attributes import WorkflowDataAttributes
from datadog_api_client.v2.model.workflow_data_type import WorkflowDataType
from datadog_api_client.v2.model.workflow_run_as_service_account import WorkflowRunAsServiceAccount
from datadog_api_client.v2.model.workflow_run_as_service_account_type import WorkflowRunAsServiceAccountType

# there is a valid "service_account_user" in the system
SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"]

body = CreateWorkflowRequest(
data=WorkflowData(
attributes=WorkflowDataAttributes(
description="A sample workflow.",
name="Example Workflow",
published=True,
run_as=WorkflowRunAsServiceAccount(
type=WorkflowRunAsServiceAccountType.SERVICE_ACCOUNT,
id=SERVICE_ACCOUNT_USER_DATA_ID,
),
spec=Spec(
connection_envs=[
ConnectionEnv(
Expand Down
9 changes: 9 additions & 0 deletions examples/v2/workflow-automation/UpdateWorkflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,25 @@
from datadog_api_client.v2.model.workflow_data_type import WorkflowDataType
from datadog_api_client.v2.model.workflow_data_update import WorkflowDataUpdate
from datadog_api_client.v2.model.workflow_data_update_attributes import WorkflowDataUpdateAttributes
from datadog_api_client.v2.model.workflow_run_as_service_account import WorkflowRunAsServiceAccount
from datadog_api_client.v2.model.workflow_run_as_service_account_type import WorkflowRunAsServiceAccountType

# there is a valid "workflow" in the system
WORKFLOW_DATA_ID = environ["WORKFLOW_DATA_ID"]

# there is a valid "service_account_user" in the system
SERVICE_ACCOUNT_USER_DATA_ID = environ["SERVICE_ACCOUNT_USER_DATA_ID"]

body = UpdateWorkflowRequest(
data=WorkflowDataUpdate(
attributes=WorkflowDataUpdateAttributes(
description="A sample workflow.",
name="Example Workflow",
published=True,
run_as=WorkflowRunAsServiceAccount(
type=WorkflowRunAsServiceAccountType.SERVICE_ACCOUNT,
id=SERVICE_ACCOUNT_USER_DATA_ID,
),
spec=Spec(
connection_envs=[
ConnectionEnv(
Expand Down
25 changes: 25 additions & 0 deletions src/datadog_api_client/v2/model/workflow_data_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,28 @@


if TYPE_CHECKING:
from datadog_api_client.v2.model.workflow_run_as import WorkflowRunAs
from datadog_api_client.v2.model.workflow_run_as_user_mode import WorkflowRunAsUserMode
from datadog_api_client.v2.model.spec import Spec
from datadog_api_client.v2.model.workflow_run_as_owner import WorkflowRunAsOwner
from datadog_api_client.v2.model.workflow_run_as_service_account import WorkflowRunAsServiceAccount
from datadog_api_client.v2.model.workflow_run_as_initiator import WorkflowRunAsInitiator


class WorkflowDataAttributes(ModelNormal):
@cached_property
def openapi_types(_):
from datadog_api_client.v2.model.workflow_run_as import WorkflowRunAs
from datadog_api_client.v2.model.workflow_run_as_user_mode import WorkflowRunAsUserMode
from datadog_api_client.v2.model.spec import Spec

return {
"created_at": (datetime,),
"description": (str,),
"name": (str,),
"published": (bool,),
"run_as": (WorkflowRunAs,),
"run_as_user_mode": (WorkflowRunAsUserMode,),
"spec": (Spec,),
"tags": ([str],),
"updated_at": (datetime,),
Expand All @@ -39,6 +48,8 @@ def openapi_types(_):
"description": "description",
"name": "name",
"published": "published",
"run_as": "runAs",
"run_as_user_mode": "runAsUserMode",
"spec": "spec",
"tags": "tags",
"updated_at": "updatedAt",
Expand All @@ -56,6 +67,10 @@ def __init__(
created_at: Union[datetime, UnsetType] = unset,
description: Union[str, UnsetType] = unset,
published: Union[bool, UnsetType] = unset,
run_as: Union[
WorkflowRunAs, WorkflowRunAsOwner, WorkflowRunAsServiceAccount, WorkflowRunAsInitiator, UnsetType
] = unset,
run_as_user_mode: Union[WorkflowRunAsUserMode, UnsetType] = unset,
tags: Union[List[str], UnsetType] = unset,
updated_at: Union[datetime, UnsetType] = unset,
webhook_secret: Union[str, UnsetType] = unset,
Expand All @@ -76,6 +91,12 @@ def __init__(
:param published: Set the workflow to published or unpublished. Workflows in an unpublished state will only be executable via manual runs. Automatic triggers such as Schedule will not execute the workflow until it is published.
:type published: bool, optional

:param run_as: Identity used to run the workflow.
:type run_as: WorkflowRunAs, optional

:param run_as_user_mode: The effective type of identity used to run the workflow.
:type run_as_user_mode: WorkflowRunAsUserMode, optional

:param spec: A complete Workflow Automation definition, including its triggers, steps, and connections.
:type spec: Spec

Expand All @@ -94,6 +115,10 @@ def __init__(
kwargs["description"] = description
if published is not unset:
kwargs["published"] = published
if run_as is not unset:
kwargs["run_as"] = run_as
if run_as_user_mode is not unset:
kwargs["run_as_user_mode"] = run_as_user_mode
if tags is not unset:
kwargs["tags"] = tags
if updated_at is not unset:
Expand Down
Loading
Loading