diff --git a/.apigentools-info b/.apigentools-info index 9682a7f5cfa..e0cd86cbec9 100644 --- a/.apigentools-info +++ b/.apigentools-info @@ -4,13 +4,13 @@ "spec_versions": { "v1": { "apigentools_version": "1.6.6", - "regenerated": "2024-07-25 18:59:27.218959", - "spec_repo_commit": "ccf15bee" + "regenerated": "2024-07-26 14:24:39.572582", + "spec_repo_commit": "54ffed1b" }, "v2": { "apigentools_version": "1.6.6", - "regenerated": "2024-07-25 18:59:27.236772", - "spec_repo_commit": "ccf15bee" + "regenerated": "2024-07-26 14:24:39.591931", + "spec_repo_commit": "54ffed1b" } } } \ No newline at end of file diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index d921feb3775..2c9969bbb77 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -351,6 +351,13 @@ components: required: true schema: type: string + InstanceId: + description: The ID of the workflow instance. + in: path + name: instance_id + required: true + schema: + type: string MetricID: description: The name of the log-based metric. in: path @@ -536,6 +543,13 @@ components: schema: example: 00000000-0000-9999-0000-000000000000 type: string + WorkflowId: + description: The ID of the workflow. + in: path + name: workflow_id + required: true + schema: + type: string requestBodies: {} responses: BadRequestResponse: @@ -23594,6 +23608,89 @@ components: - PAST_SIX_MONTHS - PAST_ONE_YEAR - ALERT + WorkflowInstanceCreateMeta: + description: Additional information for creating a workflow instance. + properties: + payload: + additionalProperties: {} + description: The input parameters to the workflow. + type: object + type: object + WorkflowInstanceCreateRequest: + description: Request used to create a workflow instance. + properties: + meta: + $ref: '#/components/schemas/WorkflowInstanceCreateMeta' + type: object + WorkflowInstanceCreateResponse: + additionalProperties: {} + description: Response returned upon successful workflow instance creation. + properties: + data: + $ref: '#/components/schemas/WorkflowInstanceCreateResponseData' + type: object + WorkflowInstanceCreateResponseData: + additionalProperties: {} + description: Data about the created workflow instance. + properties: + id: + description: The ID of the workflow execution. It can be used to fetch the + execution status. + type: string + type: object + WorkflowInstanceListItem: + additionalProperties: {} + description: An item in the workflow instances list. + properties: + id: + description: The ID of the workflow instance + type: string + type: object + WorkflowListInstancesResponse: + additionalProperties: {} + description: Response returned when listing workflow instances. + properties: + data: + description: A list of workflow instances. + items: + $ref: '#/components/schemas/WorkflowInstanceListItem' + type: array + type: object + WorklflowCancelInstanceResponse: + description: Information about the canceled instance. + properties: + data: + $ref: '#/components/schemas/WorklflowCancelInstanceResponseData' + type: object + WorklflowCancelInstanceResponseData: + description: Data about the canceled instance. + properties: + id: + description: The id of the canceled instance + type: string + type: object + WorklflowGetInstanceResponse: + additionalProperties: {} + description: The state of the given workflow instance. + properties: + data: + $ref: '#/components/schemas/WorklflowGetInstanceResponseData' + type: object + WorklflowGetInstanceResponseData: + additionalProperties: {} + description: The data of the instance response. + properties: + attributes: + $ref: '#/components/schemas/WorklflowGetInstanceResponseDataAttributes' + type: object + WorklflowGetInstanceResponseDataAttributes: + additionalProperties: {} + description: The attributes of the instance response data. + properties: + id: + description: The id of the instance. + type: string + type: object securitySchemes: AuthZ: description: This API uses OAuth 2 with the implicit grant flow. @@ -37501,6 +37598,148 @@ paths: summary: Get user memberships tags: - Teams + /api/v2/workflows/{workflow_id}/instances: + get: + description: List all instances of a given workflow. + operationId: ListWorkflowInstances + parameters: + - $ref: '#/components/parameters/WorkflowId' + - $ref: '#/components/parameters/PageSize' + - $ref: '#/components/parameters/PageNumber' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowListInstancesResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: List workflow instances + tags: + - Workflow Automation + post: + description: Execute the given workflow + operationId: CreateWorkflowInstance + parameters: + - $ref: '#/components/parameters/WorkflowId' + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowInstanceCreateRequest' + required: true + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WorkflowInstanceCreateResponse' + description: Created + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Execute a workflow + tags: + - Workflow Automation + x-codegen-request-body-name: body + /api/v2/workflows/{workflow_id}/instances/{instance_id}: + get: + description: Get a specific execution of a given workflow. + operationId: GetWorkflowInstance + parameters: + - $ref: '#/components/parameters/WorkflowId' + - $ref: '#/components/parameters/InstanceId' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WorklflowGetInstanceResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Get a workflow instance + tags: + - Workflow Automation + /api/v2/workflows/{workflow_id}/instances/{instance_id}/cancel: + put: + description: Cancels a specific execution of a given workflow. + operationId: CancelWorkflowInstance + parameters: + - $ref: '#/components/parameters/WorkflowId' + - $ref: '#/components/parameters/InstanceId' + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/WorklflowCancelInstanceResponse' + description: OK + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Bad Request + '403': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Forbidden + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/APIErrorResponse' + description: Not Found + '429': + $ref: '#/components/responses/TooManyRequestsResponse' + summary: Cancel a workflow instance + tags: + - Workflow Automation security: - apiKeyAuth: [] appKeyAuth: [] @@ -37872,4 +38111,9 @@ tags: externalDocs: url: https://docs.datadoghq.com/account_management/users name: Users +- description: Automate your teams operational processes with Datadog Workflow Automation. + externalDocs: + description: Find out more at + url: https://docs.datadoghq.com/service_management/workflows/ + name: Workflow Automation x-group-parameters: true diff --git a/api/datadogV2/api_workflow_automation.go b/api/datadogV2/api_workflow_automation.go new file mode 100644 index 00000000000..eb517204a53 --- /dev/null +++ b/api/datadogV2/api_workflow_automation.go @@ -0,0 +1,351 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + _context "context" + _nethttp "net/http" + _neturl "net/url" + "strings" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// WorkflowAutomationApi service type +type WorkflowAutomationApi datadog.Service + +// CancelWorkflowInstance Cancel a workflow instance. +// Cancels a specific execution of a given workflow. +func (a *WorkflowAutomationApi) CancelWorkflowInstance(ctx _context.Context, workflowId string, instanceId string) (WorklflowCancelInstanceResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPut + localVarPostBody interface{} + localVarReturnValue WorklflowCancelInstanceResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.WorkflowAutomationApi.CancelWorkflowInstance") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/workflows/{workflow_id}/instances/{instance_id}/cancel" + localVarPath = strings.Replace(localVarPath, "{"+"workflow_id"+"}", _neturl.PathEscape(datadog.ParameterToString(workflowId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instance_id"+"}", _neturl.PathEscape(datadog.ParameterToString(instanceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// CreateWorkflowInstance Execute a workflow. +// Execute the given workflow +func (a *WorkflowAutomationApi) CreateWorkflowInstance(ctx _context.Context, workflowId string, body WorkflowInstanceCreateRequest) (WorkflowInstanceCreateResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodPost + localVarPostBody interface{} + localVarReturnValue WorkflowInstanceCreateResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.WorkflowAutomationApi.CreateWorkflowInstance") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/workflows/{workflow_id}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"workflow_id"+"}", _neturl.PathEscape(datadog.ParameterToString(workflowId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Content-Type"] = "application/json" + localVarHeaderParams["Accept"] = "application/json" + + // body params + localVarPostBody = &body + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// GetWorkflowInstance Get a workflow instance. +// Get a specific execution of a given workflow. +func (a *WorkflowAutomationApi) GetWorkflowInstance(ctx _context.Context, workflowId string, instanceId string) (WorklflowGetInstanceResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue WorklflowGetInstanceResponse + ) + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.WorkflowAutomationApi.GetWorkflowInstance") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/workflows/{workflow_id}/instances/{instance_id}" + localVarPath = strings.Replace(localVarPath, "{"+"workflow_id"+"}", _neturl.PathEscape(datadog.ParameterToString(workflowId, "")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instance_id"+"}", _neturl.PathEscape(datadog.ParameterToString(instanceId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 404 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// ListWorkflowInstancesOptionalParameters holds optional parameters for ListWorkflowInstances. +type ListWorkflowInstancesOptionalParameters struct { + PageSize *int64 + PageNumber *int64 +} + +// NewListWorkflowInstancesOptionalParameters creates an empty struct for parameters. +func NewListWorkflowInstancesOptionalParameters() *ListWorkflowInstancesOptionalParameters { + this := ListWorkflowInstancesOptionalParameters{} + return &this +} + +// WithPageSize sets the corresponding parameter name and returns the struct. +func (r *ListWorkflowInstancesOptionalParameters) WithPageSize(pageSize int64) *ListWorkflowInstancesOptionalParameters { + r.PageSize = &pageSize + return r +} + +// WithPageNumber sets the corresponding parameter name and returns the struct. +func (r *ListWorkflowInstancesOptionalParameters) WithPageNumber(pageNumber int64) *ListWorkflowInstancesOptionalParameters { + r.PageNumber = &pageNumber + return r +} + +// ListWorkflowInstances List workflow instances. +// List all instances of a given workflow. +func (a *WorkflowAutomationApi) ListWorkflowInstances(ctx _context.Context, workflowId string, o ...ListWorkflowInstancesOptionalParameters) (WorkflowListInstancesResponse, *_nethttp.Response, error) { + var ( + localVarHTTPMethod = _nethttp.MethodGet + localVarPostBody interface{} + localVarReturnValue WorkflowListInstancesResponse + optionalParams ListWorkflowInstancesOptionalParameters + ) + + if len(o) > 1 { + return localVarReturnValue, nil, datadog.ReportError("only one argument of type ListWorkflowInstancesOptionalParameters is allowed") + } + if len(o) == 1 { + optionalParams = o[0] + } + + localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.WorkflowAutomationApi.ListWorkflowInstances") + if err != nil { + return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()} + } + + localVarPath := localBasePath + "/api/v2/workflows/{workflow_id}/instances" + localVarPath = strings.Replace(localVarPath, "{"+"workflow_id"+"}", _neturl.PathEscape(datadog.ParameterToString(workflowId, "")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := _neturl.Values{} + localVarFormParams := _neturl.Values{} + if optionalParams.PageSize != nil { + localVarQueryParams.Add("page[size]", datadog.ParameterToString(*optionalParams.PageSize, "")) + } + if optionalParams.PageNumber != nil { + localVarQueryParams.Add("page[number]", datadog.ParameterToString(*optionalParams.PageNumber, "")) + } + localVarHeaderParams["Accept"] = "application/json" + + datadog.SetAuthKeys( + ctx, + &localVarHeaderParams, + [2]string{"apiKeyAuth", "DD-API-KEY"}, + [2]string{"appKeyAuth", "DD-APPLICATION-KEY"}, + ) + req, err := a.Client.PrepareRequest(ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, nil) + if err != nil { + return localVarReturnValue, nil, err + } + + localVarHTTPResponse, err := a.Client.CallAPI(req) + if err != nil || localVarHTTPResponse == nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + localVarBody, err := datadog.ReadBody(localVarHTTPResponse) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, err + } + + if localVarHTTPResponse.StatusCode >= 300 { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: localVarHTTPResponse.Status, + } + if localVarHTTPResponse.StatusCode == 400 || localVarHTTPResponse.StatusCode == 403 || localVarHTTPResponse.StatusCode == 429 { + var v APIErrorResponse + err = a.Client.Decode(&v, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + return localVarReturnValue, localVarHTTPResponse, newErr + } + newErr.ErrorModel = v + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + err = a.Client.Decode(&localVarReturnValue, localVarBody, localVarHTTPResponse.Header.Get("Content-Type")) + if err != nil { + newErr := datadog.GenericOpenAPIError{ + ErrorBody: localVarBody, + ErrorMessage: err.Error(), + } + return localVarReturnValue, localVarHTTPResponse, newErr + } + + return localVarReturnValue, localVarHTTPResponse, nil +} + +// NewWorkflowAutomationApi Returns NewWorkflowAutomationApi. +func NewWorkflowAutomationApi(client *datadog.APIClient) *WorkflowAutomationApi { + return &WorkflowAutomationApi{ + Client: client, + } +} diff --git a/api/datadogV2/doc.go b/api/datadogV2/doc.go index 29bf482d5ad..d5db9041c76 100644 --- a/api/datadogV2/doc.go +++ b/api/datadogV2/doc.go @@ -347,4 +347,8 @@ // - [UsersApi.ListUsers] // - [UsersApi.SendInvitations] // - [UsersApi.UpdateUser] +// - [WorkflowAutomationApi.CancelWorkflowInstance] +// - [WorkflowAutomationApi.CreateWorkflowInstance] +// - [WorkflowAutomationApi.GetWorkflowInstance] +// - [WorkflowAutomationApi.ListWorkflowInstances] package datadogV2 diff --git a/api/datadogV2/model_workflow_instance_create_meta.go b/api/datadogV2/model_workflow_instance_create_meta.go new file mode 100644 index 00000000000..2f356cfb582 --- /dev/null +++ b/api/datadogV2/model_workflow_instance_create_meta.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// WorkflowInstanceCreateMeta Additional information for creating a workflow instance. +type WorkflowInstanceCreateMeta struct { + // The input parameters to the workflow. + Payload map[string]interface{} `json:"payload,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewWorkflowInstanceCreateMeta instantiates a new WorkflowInstanceCreateMeta object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewWorkflowInstanceCreateMeta() *WorkflowInstanceCreateMeta { + this := WorkflowInstanceCreateMeta{} + return &this +} + +// NewWorkflowInstanceCreateMetaWithDefaults instantiates a new WorkflowInstanceCreateMeta object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewWorkflowInstanceCreateMetaWithDefaults() *WorkflowInstanceCreateMeta { + this := WorkflowInstanceCreateMeta{} + return &this +} + +// GetPayload returns the Payload field value if set, zero value otherwise. +func (o *WorkflowInstanceCreateMeta) GetPayload() map[string]interface{} { + if o == nil || o.Payload == nil { + var ret map[string]interface{} + return ret + } + return o.Payload +} + +// GetPayloadOk returns a tuple with the Payload field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorkflowInstanceCreateMeta) GetPayloadOk() (*map[string]interface{}, bool) { + if o == nil || o.Payload == nil { + return nil, false + } + return &o.Payload, true +} + +// HasPayload returns a boolean if a field has been set. +func (o *WorkflowInstanceCreateMeta) HasPayload() bool { + return o != nil && o.Payload != nil +} + +// SetPayload gets a reference to the given map[string]interface{} and assigns it to the Payload field. +func (o *WorkflowInstanceCreateMeta) SetPayload(v map[string]interface{}) { + o.Payload = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WorkflowInstanceCreateMeta) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Payload != nil { + toSerialize["payload"] = o.Payload + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WorkflowInstanceCreateMeta) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Payload map[string]interface{} `json:"payload,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"payload"}) + } else { + return err + } + o.Payload = all.Payload + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_workflow_instance_create_request.go b/api/datadogV2/model_workflow_instance_create_request.go new file mode 100644 index 00000000000..3f43d31673e --- /dev/null +++ b/api/datadogV2/model_workflow_instance_create_request.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// WorkflowInstanceCreateRequest Request used to create a workflow instance. +type WorkflowInstanceCreateRequest struct { + // Additional information for creating a workflow instance. + Meta *WorkflowInstanceCreateMeta `json:"meta,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewWorkflowInstanceCreateRequest instantiates a new WorkflowInstanceCreateRequest object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewWorkflowInstanceCreateRequest() *WorkflowInstanceCreateRequest { + this := WorkflowInstanceCreateRequest{} + return &this +} + +// NewWorkflowInstanceCreateRequestWithDefaults instantiates a new WorkflowInstanceCreateRequest object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewWorkflowInstanceCreateRequestWithDefaults() *WorkflowInstanceCreateRequest { + this := WorkflowInstanceCreateRequest{} + return &this +} + +// GetMeta returns the Meta field value if set, zero value otherwise. +func (o *WorkflowInstanceCreateRequest) GetMeta() WorkflowInstanceCreateMeta { + if o == nil || o.Meta == nil { + var ret WorkflowInstanceCreateMeta + return ret + } + return *o.Meta +} + +// GetMetaOk returns a tuple with the Meta field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorkflowInstanceCreateRequest) GetMetaOk() (*WorkflowInstanceCreateMeta, bool) { + if o == nil || o.Meta == nil { + return nil, false + } + return o.Meta, true +} + +// HasMeta returns a boolean if a field has been set. +func (o *WorkflowInstanceCreateRequest) HasMeta() bool { + return o != nil && o.Meta != nil +} + +// SetMeta gets a reference to the given WorkflowInstanceCreateMeta and assigns it to the Meta field. +func (o *WorkflowInstanceCreateRequest) SetMeta(v WorkflowInstanceCreateMeta) { + o.Meta = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WorkflowInstanceCreateRequest) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Meta != nil { + toSerialize["meta"] = o.Meta + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WorkflowInstanceCreateRequest) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Meta *WorkflowInstanceCreateMeta `json:"meta,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"meta"}) + } else { + return err + } + + hasInvalidField := false + if all.Meta != nil && all.Meta.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Meta = all.Meta + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_workflow_instance_create_response.go b/api/datadogV2/model_workflow_instance_create_response.go new file mode 100644 index 00000000000..99c0d4bb8c9 --- /dev/null +++ b/api/datadogV2/model_workflow_instance_create_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// WorkflowInstanceCreateResponse Response returned upon successful workflow instance creation. +type WorkflowInstanceCreateResponse struct { + // Data about the created workflow instance. + Data *WorkflowInstanceCreateResponseData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewWorkflowInstanceCreateResponse instantiates a new WorkflowInstanceCreateResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewWorkflowInstanceCreateResponse() *WorkflowInstanceCreateResponse { + this := WorkflowInstanceCreateResponse{} + return &this +} + +// NewWorkflowInstanceCreateResponseWithDefaults instantiates a new WorkflowInstanceCreateResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewWorkflowInstanceCreateResponseWithDefaults() *WorkflowInstanceCreateResponse { + this := WorkflowInstanceCreateResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *WorkflowInstanceCreateResponse) GetData() WorkflowInstanceCreateResponseData { + if o == nil || o.Data == nil { + var ret WorkflowInstanceCreateResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorkflowInstanceCreateResponse) GetDataOk() (*WorkflowInstanceCreateResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *WorkflowInstanceCreateResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given WorkflowInstanceCreateResponseData and assigns it to the Data field. +func (o *WorkflowInstanceCreateResponse) SetData(v WorkflowInstanceCreateResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WorkflowInstanceCreateResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WorkflowInstanceCreateResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *WorkflowInstanceCreateResponseData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_workflow_instance_create_response_data.go b/api/datadogV2/model_workflow_instance_create_response_data.go new file mode 100644 index 00000000000..2ea52d0b808 --- /dev/null +++ b/api/datadogV2/model_workflow_instance_create_response_data.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// WorkflowInstanceCreateResponseData Data about the created workflow instance. +type WorkflowInstanceCreateResponseData struct { + // The ID of the workflow execution. It can be used to fetch the execution status. + Id *string `json:"id,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewWorkflowInstanceCreateResponseData instantiates a new WorkflowInstanceCreateResponseData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewWorkflowInstanceCreateResponseData() *WorkflowInstanceCreateResponseData { + this := WorkflowInstanceCreateResponseData{} + return &this +} + +// NewWorkflowInstanceCreateResponseDataWithDefaults instantiates a new WorkflowInstanceCreateResponseData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewWorkflowInstanceCreateResponseDataWithDefaults() *WorkflowInstanceCreateResponseData { + this := WorkflowInstanceCreateResponseData{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *WorkflowInstanceCreateResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorkflowInstanceCreateResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *WorkflowInstanceCreateResponseData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *WorkflowInstanceCreateResponseData) SetId(v string) { + o.Id = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WorkflowInstanceCreateResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WorkflowInstanceCreateResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id"}) + } else { + return err + } + o.Id = all.Id + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_workflow_instance_list_item.go b/api/datadogV2/model_workflow_instance_list_item.go new file mode 100644 index 00000000000..95d253c5652 --- /dev/null +++ b/api/datadogV2/model_workflow_instance_list_item.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// WorkflowInstanceListItem An item in the workflow instances list. +type WorkflowInstanceListItem struct { + // The ID of the workflow instance + Id *string `json:"id,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewWorkflowInstanceListItem instantiates a new WorkflowInstanceListItem object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewWorkflowInstanceListItem() *WorkflowInstanceListItem { + this := WorkflowInstanceListItem{} + return &this +} + +// NewWorkflowInstanceListItemWithDefaults instantiates a new WorkflowInstanceListItem object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewWorkflowInstanceListItemWithDefaults() *WorkflowInstanceListItem { + this := WorkflowInstanceListItem{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *WorkflowInstanceListItem) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorkflowInstanceListItem) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *WorkflowInstanceListItem) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *WorkflowInstanceListItem) SetId(v string) { + o.Id = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WorkflowInstanceListItem) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WorkflowInstanceListItem) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id"}) + } else { + return err + } + o.Id = all.Id + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_workflow_list_instances_response.go b/api/datadogV2/model_workflow_list_instances_response.go new file mode 100644 index 00000000000..326be830bfe --- /dev/null +++ b/api/datadogV2/model_workflow_list_instances_response.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// WorkflowListInstancesResponse Response returned when listing workflow instances. +type WorkflowListInstancesResponse struct { + // A list of workflow instances. + Data []WorkflowInstanceListItem `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewWorkflowListInstancesResponse instantiates a new WorkflowListInstancesResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewWorkflowListInstancesResponse() *WorkflowListInstancesResponse { + this := WorkflowListInstancesResponse{} + return &this +} + +// NewWorkflowListInstancesResponseWithDefaults instantiates a new WorkflowListInstancesResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewWorkflowListInstancesResponseWithDefaults() *WorkflowListInstancesResponse { + this := WorkflowListInstancesResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *WorkflowListInstancesResponse) GetData() []WorkflowInstanceListItem { + if o == nil || o.Data == nil { + var ret []WorkflowInstanceListItem + return ret + } + return o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorkflowListInstancesResponse) GetDataOk() (*[]WorkflowInstanceListItem, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return &o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *WorkflowListInstancesResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given []WorkflowInstanceListItem and assigns it to the Data field. +func (o *WorkflowListInstancesResponse) SetData(v []WorkflowInstanceListItem) { + o.Data = v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WorkflowListInstancesResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WorkflowListInstancesResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data []WorkflowInstanceListItem `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_worklflow_cancel_instance_response.go b/api/datadogV2/model_worklflow_cancel_instance_response.go new file mode 100644 index 00000000000..d38678d8998 --- /dev/null +++ b/api/datadogV2/model_worklflow_cancel_instance_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// WorklflowCancelInstanceResponse Information about the canceled instance. +type WorklflowCancelInstanceResponse struct { + // Data about the canceled instance. + Data *WorklflowCancelInstanceResponseData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewWorklflowCancelInstanceResponse instantiates a new WorklflowCancelInstanceResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewWorklflowCancelInstanceResponse() *WorklflowCancelInstanceResponse { + this := WorklflowCancelInstanceResponse{} + return &this +} + +// NewWorklflowCancelInstanceResponseWithDefaults instantiates a new WorklflowCancelInstanceResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewWorklflowCancelInstanceResponseWithDefaults() *WorklflowCancelInstanceResponse { + this := WorklflowCancelInstanceResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *WorklflowCancelInstanceResponse) GetData() WorklflowCancelInstanceResponseData { + if o == nil || o.Data == nil { + var ret WorklflowCancelInstanceResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorklflowCancelInstanceResponse) GetDataOk() (*WorklflowCancelInstanceResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *WorklflowCancelInstanceResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given WorklflowCancelInstanceResponseData and assigns it to the Data field. +func (o *WorklflowCancelInstanceResponse) SetData(v WorklflowCancelInstanceResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WorklflowCancelInstanceResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WorklflowCancelInstanceResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *WorklflowCancelInstanceResponseData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_worklflow_cancel_instance_response_data.go b/api/datadogV2/model_worklflow_cancel_instance_response_data.go new file mode 100644 index 00000000000..54a3eaf3abd --- /dev/null +++ b/api/datadogV2/model_worklflow_cancel_instance_response_data.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// WorklflowCancelInstanceResponseData Data about the canceled instance. +type WorklflowCancelInstanceResponseData struct { + // The id of the canceled instance + Id *string `json:"id,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewWorklflowCancelInstanceResponseData instantiates a new WorklflowCancelInstanceResponseData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewWorklflowCancelInstanceResponseData() *WorklflowCancelInstanceResponseData { + this := WorklflowCancelInstanceResponseData{} + return &this +} + +// NewWorklflowCancelInstanceResponseDataWithDefaults instantiates a new WorklflowCancelInstanceResponseData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewWorklflowCancelInstanceResponseDataWithDefaults() *WorklflowCancelInstanceResponseData { + this := WorklflowCancelInstanceResponseData{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *WorklflowCancelInstanceResponseData) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorklflowCancelInstanceResponseData) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *WorklflowCancelInstanceResponseData) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *WorklflowCancelInstanceResponseData) SetId(v string) { + o.Id = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WorklflowCancelInstanceResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WorklflowCancelInstanceResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id"}) + } else { + return err + } + o.Id = all.Id + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/api/datadogV2/model_worklflow_get_instance_response.go b/api/datadogV2/model_worklflow_get_instance_response.go new file mode 100644 index 00000000000..f324b81ca7e --- /dev/null +++ b/api/datadogV2/model_worklflow_get_instance_response.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// WorklflowGetInstanceResponse The state of the given workflow instance. +type WorklflowGetInstanceResponse struct { + // The data of the instance response. + Data *WorklflowGetInstanceResponseData `json:"data,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewWorklflowGetInstanceResponse instantiates a new WorklflowGetInstanceResponse object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewWorklflowGetInstanceResponse() *WorklflowGetInstanceResponse { + this := WorklflowGetInstanceResponse{} + return &this +} + +// NewWorklflowGetInstanceResponseWithDefaults instantiates a new WorklflowGetInstanceResponse object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewWorklflowGetInstanceResponseWithDefaults() *WorklflowGetInstanceResponse { + this := WorklflowGetInstanceResponse{} + return &this +} + +// GetData returns the Data field value if set, zero value otherwise. +func (o *WorklflowGetInstanceResponse) GetData() WorklflowGetInstanceResponseData { + if o == nil || o.Data == nil { + var ret WorklflowGetInstanceResponseData + return ret + } + return *o.Data +} + +// GetDataOk returns a tuple with the Data field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorklflowGetInstanceResponse) GetDataOk() (*WorklflowGetInstanceResponseData, bool) { + if o == nil || o.Data == nil { + return nil, false + } + return o.Data, true +} + +// HasData returns a boolean if a field has been set. +func (o *WorklflowGetInstanceResponse) HasData() bool { + return o != nil && o.Data != nil +} + +// SetData gets a reference to the given WorklflowGetInstanceResponseData and assigns it to the Data field. +func (o *WorklflowGetInstanceResponse) SetData(v WorklflowGetInstanceResponseData) { + o.Data = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WorklflowGetInstanceResponse) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Data != nil { + toSerialize["data"] = o.Data + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WorklflowGetInstanceResponse) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Data *WorklflowGetInstanceResponseData `json:"data,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"data"}) + } else { + return err + } + + hasInvalidField := false + if all.Data != nil && all.Data.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Data = all.Data + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_worklflow_get_instance_response_data.go b/api/datadogV2/model_worklflow_get_instance_response_data.go new file mode 100644 index 00000000000..fef695fccd7 --- /dev/null +++ b/api/datadogV2/model_worklflow_get_instance_response_data.go @@ -0,0 +1,111 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// WorklflowGetInstanceResponseData The data of the instance response. +type WorklflowGetInstanceResponseData struct { + // The attributes of the instance response data. + Attributes *WorklflowGetInstanceResponseDataAttributes `json:"attributes,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewWorklflowGetInstanceResponseData instantiates a new WorklflowGetInstanceResponseData object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewWorklflowGetInstanceResponseData() *WorklflowGetInstanceResponseData { + this := WorklflowGetInstanceResponseData{} + return &this +} + +// NewWorklflowGetInstanceResponseDataWithDefaults instantiates a new WorklflowGetInstanceResponseData object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewWorklflowGetInstanceResponseDataWithDefaults() *WorklflowGetInstanceResponseData { + this := WorklflowGetInstanceResponseData{} + return &this +} + +// GetAttributes returns the Attributes field value if set, zero value otherwise. +func (o *WorklflowGetInstanceResponseData) GetAttributes() WorklflowGetInstanceResponseDataAttributes { + if o == nil || o.Attributes == nil { + var ret WorklflowGetInstanceResponseDataAttributes + return ret + } + return *o.Attributes +} + +// GetAttributesOk returns a tuple with the Attributes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorklflowGetInstanceResponseData) GetAttributesOk() (*WorklflowGetInstanceResponseDataAttributes, bool) { + if o == nil || o.Attributes == nil { + return nil, false + } + return o.Attributes, true +} + +// HasAttributes returns a boolean if a field has been set. +func (o *WorklflowGetInstanceResponseData) HasAttributes() bool { + return o != nil && o.Attributes != nil +} + +// SetAttributes gets a reference to the given WorklflowGetInstanceResponseDataAttributes and assigns it to the Attributes field. +func (o *WorklflowGetInstanceResponseData) SetAttributes(v WorklflowGetInstanceResponseDataAttributes) { + o.Attributes = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WorklflowGetInstanceResponseData) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Attributes != nil { + toSerialize["attributes"] = o.Attributes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WorklflowGetInstanceResponseData) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Attributes *WorklflowGetInstanceResponseDataAttributes `json:"attributes,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"attributes"}) + } else { + return err + } + + hasInvalidField := false + if all.Attributes != nil && all.Attributes.UnparsedObject != nil && o.UnparsedObject == nil { + hasInvalidField = true + } + o.Attributes = all.Attributes + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + if hasInvalidField { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + + return nil +} diff --git a/api/datadogV2/model_worklflow_get_instance_response_data_attributes.go b/api/datadogV2/model_worklflow_get_instance_response_data_attributes.go new file mode 100644 index 00000000000..ab4f731cd5e --- /dev/null +++ b/api/datadogV2/model_worklflow_get_instance_response_data_attributes.go @@ -0,0 +1,102 @@ +// Unless explicitly stated otherwise all files in this repository are licensed under the Apache-2.0 License. +// This product includes software developed at Datadog (https://www.datadoghq.com/). +// Copyright 2019-Present Datadog, Inc. + +package datadogV2 + +import ( + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" +) + +// WorklflowGetInstanceResponseDataAttributes The attributes of the instance response data. +type WorklflowGetInstanceResponseDataAttributes struct { + // The id of the instance. + Id *string `json:"id,omitempty"` + // UnparsedObject contains the raw value of the object if there was an error when deserializing into the struct + UnparsedObject map[string]interface{} `json:"-"` + AdditionalProperties map[string]interface{} +} + +// NewWorklflowGetInstanceResponseDataAttributes instantiates a new WorklflowGetInstanceResponseDataAttributes object. +// This constructor will assign default values to properties that have it defined, +// and makes sure properties required by API are set, but the set of arguments +// will change when the set of required properties is changed. +func NewWorklflowGetInstanceResponseDataAttributes() *WorklflowGetInstanceResponseDataAttributes { + this := WorklflowGetInstanceResponseDataAttributes{} + return &this +} + +// NewWorklflowGetInstanceResponseDataAttributesWithDefaults instantiates a new WorklflowGetInstanceResponseDataAttributes object. +// This constructor will only assign default values to properties that have it defined, +// but it doesn't guarantee that properties required by API are set. +func NewWorklflowGetInstanceResponseDataAttributesWithDefaults() *WorklflowGetInstanceResponseDataAttributes { + this := WorklflowGetInstanceResponseDataAttributes{} + return &this +} + +// GetId returns the Id field value if set, zero value otherwise. +func (o *WorklflowGetInstanceResponseDataAttributes) GetId() string { + if o == nil || o.Id == nil { + var ret string + return ret + } + return *o.Id +} + +// GetIdOk returns a tuple with the Id field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *WorklflowGetInstanceResponseDataAttributes) GetIdOk() (*string, bool) { + if o == nil || o.Id == nil { + return nil, false + } + return o.Id, true +} + +// HasId returns a boolean if a field has been set. +func (o *WorklflowGetInstanceResponseDataAttributes) HasId() bool { + return o != nil && o.Id != nil +} + +// SetId gets a reference to the given string and assigns it to the Id field. +func (o *WorklflowGetInstanceResponseDataAttributes) SetId(v string) { + o.Id = &v +} + +// MarshalJSON serializes the struct using spec logic. +func (o WorklflowGetInstanceResponseDataAttributes) MarshalJSON() ([]byte, error) { + toSerialize := map[string]interface{}{} + if o.UnparsedObject != nil { + return datadog.Marshal(o.UnparsedObject) + } + if o.Id != nil { + toSerialize["id"] = o.Id + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + return datadog.Marshal(toSerialize) +} + +// UnmarshalJSON deserializes the given payload. +func (o *WorklflowGetInstanceResponseDataAttributes) UnmarshalJSON(bytes []byte) (err error) { + all := struct { + Id *string `json:"id,omitempty"` + }{} + if err = datadog.Unmarshal(bytes, &all); err != nil { + return datadog.Unmarshal(bytes, &o.UnparsedObject) + } + additionalProperties := make(map[string]interface{}) + if err = datadog.Unmarshal(bytes, &additionalProperties); err == nil { + datadog.DeleteKeys(additionalProperties, &[]string{"id"}) + } else { + return err + } + o.Id = all.Id + + if len(additionalProperties) > 0 { + o.AdditionalProperties = additionalProperties + } + + return nil +} diff --git a/examples/v2/workflow-automation/CancelWorkflowInstance.go b/examples/v2/workflow-automation/CancelWorkflowInstance.go new file mode 100644 index 00000000000..c62421f74e5 --- /dev/null +++ b/examples/v2/workflow-automation/CancelWorkflowInstance.go @@ -0,0 +1,29 @@ +// Cancel a workflow instance returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewWorkflowAutomationApi(apiClient) + resp, r, err := api.CancelWorkflowInstance(ctx, "ccf73164-1998-4785-a7a3-8d06c7e5f558", "305a472b-71ab-4ce8-8f8d-75db635627b5") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `WorkflowAutomationApi.CancelWorkflowInstance`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `WorkflowAutomationApi.CancelWorkflowInstance`:\n%s\n", responseContent) +} diff --git a/examples/v2/workflow-automation/CreateWorkflowInstance.go b/examples/v2/workflow-automation/CreateWorkflowInstance.go new file mode 100644 index 00000000000..68360f844f9 --- /dev/null +++ b/examples/v2/workflow-automation/CreateWorkflowInstance.go @@ -0,0 +1,36 @@ +// Execute a workflow returns "Created" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + body := datadogV2.WorkflowInstanceCreateRequest{ + Meta: &datadogV2.WorkflowInstanceCreateMeta{ + Payload: map[string]interface{}{ + "input": "value", + }, + }, + } + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewWorkflowAutomationApi(apiClient) + resp, r, err := api.CreateWorkflowInstance(ctx, "ccf73164-1998-4785-a7a3-8d06c7e5f558", body) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `WorkflowAutomationApi.CreateWorkflowInstance`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `WorkflowAutomationApi.CreateWorkflowInstance`:\n%s\n", responseContent) +} diff --git a/examples/v2/workflow-automation/GetWorkflowInstance.go b/examples/v2/workflow-automation/GetWorkflowInstance.go new file mode 100644 index 00000000000..b6c0df118ae --- /dev/null +++ b/examples/v2/workflow-automation/GetWorkflowInstance.go @@ -0,0 +1,29 @@ +// Get a workflow instance returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewWorkflowAutomationApi(apiClient) + resp, r, err := api.GetWorkflowInstance(ctx, "ccf73164-1998-4785-a7a3-8d06c7e5f558", "305a472b-71ab-4ce8-8f8d-75db635627b5") + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `WorkflowAutomationApi.GetWorkflowInstance`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `WorkflowAutomationApi.GetWorkflowInstance`:\n%s\n", responseContent) +} diff --git a/examples/v2/workflow-automation/ListWorkflowInstances.go b/examples/v2/workflow-automation/ListWorkflowInstances.go new file mode 100644 index 00000000000..80d813e71cd --- /dev/null +++ b/examples/v2/workflow-automation/ListWorkflowInstances.go @@ -0,0 +1,29 @@ +// List workflow instances returns "OK" response + +package main + +import ( + "context" + "encoding/json" + "fmt" + "os" + + "github.com/DataDog/datadog-api-client-go/v2/api/datadog" + "github.com/DataDog/datadog-api-client-go/v2/api/datadogV2" +) + +func main() { + ctx := datadog.NewDefaultContext(context.Background()) + configuration := datadog.NewConfiguration() + apiClient := datadog.NewAPIClient(configuration) + api := datadogV2.NewWorkflowAutomationApi(apiClient) + resp, r, err := api.ListWorkflowInstances(ctx, "ccf73164-1998-4785-a7a3-8d06c7e5f558", *datadogV2.NewListWorkflowInstancesOptionalParameters()) + + if err != nil { + fmt.Fprintf(os.Stderr, "Error when calling `WorkflowAutomationApi.ListWorkflowInstances`: %v\n", err) + fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) + } + + responseContent, _ := json.MarshalIndent(resp, "", " ") + fmt.Fprintf(os.Stdout, "Response from `WorkflowAutomationApi.ListWorkflowInstances`:\n%s\n", responseContent) +} diff --git a/tests/scenarios/api_mappings.go b/tests/scenarios/api_mappings.go index 2972e942363..f3833fa4683 100644 --- a/tests/scenarios/api_mappings.go +++ b/tests/scenarios/api_mappings.go @@ -95,5 +95,6 @@ var apiMappings = map[string]map[string]reflect.Value{ "TeamsApi": reflect.ValueOf(datadogV2.NewTeamsApi), "IncidentTeamsApi": reflect.ValueOf(datadogV2.NewIncidentTeamsApi), "UsersApi": reflect.ValueOf(datadogV2.NewUsersApi), + "WorkflowAutomationApi": reflect.ValueOf(datadogV2.NewWorkflowAutomationApi), }, } \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..3b73466a4c6 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-07-24T18:39:57.489Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..d6d58a4368b --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_Bad_Request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: PUT + url: https://api.datadoghq.com/api/v2/workflows/malformed/instances/malformed/cancel + response: + body: '{"errors":[{"code":"INVALID_FIELD_VALUE","detail":"value is + invalid for field workflow_id"}]} + + ' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..674a620d56d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2024-07-24T18:39:57.698Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..41bb59ca7fe --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_Not_Found_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: PUT + url: https://api.datadoghq.com/api/v2/workflows/0233a3b7-b7ba-425e-a8cc-375ca2020b5b/instances/e0c64dc8-f946-4ae8-8d79-54569031ce67/cancel + response: + body: '{"errors":[{"code":"INSTANCE_NOT_FOUND","detail":"instance e0c64dc8-f946-4ae8-8d79-54569031ce67 + not found"}]} + + ' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_OK_response.freeze new file mode 100644 index 00000000000..a62f2698f17 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-07-24T18:39:57.827Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_OK_response.yaml new file mode 100644 index 00000000000..5cf859fd86f --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Cancel_a_workflow_instance_returns_OK_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: PUT + url: https://api.datadoghq.com/api/v2/workflows/ccf73164-1998-4785-a7a3-8d06c7e5f558/instances/305a472b-71ab-4ce8-8f8d-75db635627b5/cancel + response: + body: '{} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Execute_a_workflow_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Execute_a_workflow_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..f6b8453bd64 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Execute_a_workflow_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-07-24T18:39:57.981Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Execute_a_workflow_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Execute_a_workflow_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..a58543d9c79 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Execute_a_workflow_returns_Bad_Request_response.yaml @@ -0,0 +1,25 @@ +interactions: +- request: + body: | + {"meta":{"payload":{"input":"value"}}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/workflows/malformed/instances + response: + body: '{"errors":[{"code":"INVALID_FIELD_VALUE","detail":"value is + invalid for field workflow_id"}]} + + ' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Execute_a_workflow_returns_Created_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Execute_a_workflow_returns_Created_response.freeze new file mode 100644 index 00000000000..becb798038d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Execute_a_workflow_returns_Created_response.freeze @@ -0,0 +1 @@ +2024-07-24T18:39:58.210Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Execute_a_workflow_returns_Created_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Execute_a_workflow_returns_Created_response.yaml new file mode 100644 index 00000000000..3a165051997 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Execute_a_workflow_returns_Created_response.yaml @@ -0,0 +1,24 @@ +interactions: +- request: + body: | + {"meta":{"payload":{"input":"value"}}} + form: {} + headers: + Accept: + - application/json + Content-Type: + - application/json + id: 0 + method: POST + url: https://api.datadoghq.com/api/v2/workflows/ccf73164-1998-4785-a7a3-8d06c7e5f558/instances + response: + body: '{"data":{"attributes":{},"id":"111e18d6-3f19-4ada-91d3-ab1e1546b8b4","type":"instances"},"meta":{"workflowId":"ccf73164-1998-4785-a7a3-8d06c7e5f558"}} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..873df33c06c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-07-24T18:39:58.459Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..46f2114b97d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_Bad_Request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/workflows/malformed/instances/malformed + response: + body: '{"errors":[{"code":"INVALID_FIELD_VALUE","detail":"value is + invalid for field workflow_id"}]} + + ' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_Not_Found_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_Not_Found_response.freeze new file mode 100644 index 00000000000..72f845efca3 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_Not_Found_response.freeze @@ -0,0 +1 @@ +2024-07-24T18:39:58.587Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_Not_Found_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_Not_Found_response.yaml new file mode 100644 index 00000000000..7a850f78b9c --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_Not_Found_response.yaml @@ -0,0 +1,21 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/workflows/0233a3b7-b7ba-425e-a8cc-375ca2020b5b/instances/e0c64dc8-f946-4ae8-8d79-54569031ce67 + response: + body: '{"errors":[{"code":"WORKFLOW_NOT_FOUND","detail":"workflow not found"}]} + + ' + code: 404 + duration: 0ms + headers: + Content-Type: + - application/json + status: 404 Not Found +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_OK_response.freeze new file mode 100644 index 00000000000..95289c9822d --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-07-24T18:39:58.724Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_OK_response.yaml new file mode 100644 index 00000000000..9f77ffc822a --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_Get_a_workflow_instance_returns_OK_response.yaml @@ -0,0 +1,24 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/workflows/ccf73164-1998-4785-a7a3-8d06c7e5f558/instances/305a472b-71ab-4ce8-8f8d-75db635627b5 + response: + body: '{"data":{"attributes":{"endTimestamp":"2024-07-24T18:39:58.219283Z","instanceStatus":{"detailsKind":"CANCELED","displayName":"Canceled"},"outputs":{},"source":{"manual":{"actingUser":{"userEmail":"max.gale@datadoghq.com","userName":"Max + Gale","userUuid":"e39535f4-306b-11ee-9383-6ac9a4415a29"}}},"sourceForTemplating":{"initiator":{"email":"max.gale@datadoghq.com","id":"e39535f4-306b-11ee-9383-6ac9a4415a29","name":"Max + Gale"},"name":"Max Jul 24 2024 02:38","type":"manual","url":"https://app.datadoghq.com/workflow/ccf73164-1998-4785-a7a3-8d06c7e5f558?instance=305a472b-71ab-4ce8-8f8d-75db635627b5"},"startTimestamp":"2024-07-24T18:38:31.326418Z","stepStateAssociations":[{"stepName":"Sleep","stepState":"CANCELED"}],"trigger":{}},"id":"305a472b-71ab-4ce8-8f8d-75db635627b5","relationships":{"specVersion":{"data":{"id":"37d9abeb-2ac1-4185-91f8-86d92d5cbf7f","type":"spec_versions"}},"workflow":{"data":{"id":"ccf73164-1998-4785-a7a3-8d06c7e5f558","type":"workflows"}}},"type":"instances"},"included":[{"attributes":{"createdAt":"2024-07-24T18:38:29.839739Z","spec":{"steps":[{"actionId":"com.datadoghq.core.sleep","display":{"bounds":{"y":186}},"name":"Sleep","parameters":[{"name":"durationSeconds","value":300}]}],"triggers":[{"apiTrigger":{},"startStepNames":["Sleep"]}]},"workflowId":"ccf73164-1998-4785-a7a3-8d06c7e5f558"},"id":"37d9abeb-2ac1-4185-91f8-86d92d5cbf7f","type":"spec_versions"},{"attributes":{"createdAt":"2024-07-24T18:38:05.701669Z","creationSource":"workflows_ui","name":"Max + Jul 24 2024 02:38","specVersionId":"3d660f9c-7dfe-4fbd-bea5-f61eccea0600","updatedAt":"2024-07-24T18:38:59.939929Z"},"id":"ccf73164-1998-4785-a7a3-8d06c7e5f558","type":"workflows"}],"meta":{"outputsTooBig":false,"sourceTooBig":false,"triggerTooBig":false}} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_List_workflow_instances_returns_Bad_Request_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_List_workflow_instances_returns_Bad_Request_response.freeze new file mode 100644 index 00000000000..f07d03b73b4 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_List_workflow_instances_returns_Bad_Request_response.freeze @@ -0,0 +1 @@ +2024-07-24T18:39:58.870Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_List_workflow_instances_returns_Bad_Request_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_List_workflow_instances_returns_Bad_Request_response.yaml new file mode 100644 index 00000000000..5a21687ebe3 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_List_workflow_instances_returns_Bad_Request_response.yaml @@ -0,0 +1,22 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/workflows/malformed/instances + response: + body: '{"errors":[{"code":"INVALID_FIELD_VALUE","detail":"value is + invalid for field workflow_id"}]} + + ' + code: 400 + duration: 0ms + headers: + Content-Type: + - application/json + status: 400 Bad Request +version: 2 diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_List_workflow_instances_returns_OK_response.freeze b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_List_workflow_instances_returns_OK_response.freeze new file mode 100644 index 00000000000..27666a9e405 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_List_workflow_instances_returns_OK_response.freeze @@ -0,0 +1 @@ +2024-07-24T18:39:59.003Z \ No newline at end of file diff --git a/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_List_workflow_instances_returns_OK_response.yaml b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_List_workflow_instances_returns_OK_response.yaml new file mode 100644 index 00000000000..34fa1fe84f5 --- /dev/null +++ b/tests/scenarios/cassettes/TestScenarios/v2/Feature_Workflow_Automation/Scenario_List_workflow_instances_returns_OK_response.yaml @@ -0,0 +1,23 @@ +interactions: +- request: + body: '' + form: {} + headers: + Accept: + - application/json + id: 0 + method: GET + url: https://api.datadoghq.com/api/v2/workflows/ccf73164-1998-4785-a7a3-8d06c7e5f558/instances + response: + body: '{"data":[{"attributes":{"instanceStatus":{"detailsKind":"IN_PROGRESS","displayName":"Running"},"source":{"api":{"actingUser":{"userEmail":"max.gale@datadoghq.com","userName":"Max + Gale","userUuid":"e39535f4-306b-11ee-9383-6ac9a4415a29"}}},"startTimestamp":"2024-07-24T18:39:58.396793Z"},"id":"111e18d6-3f19-4ada-91d3-ab1e1546b8b4","type":"instances"},{"attributes":{"endTimestamp":"2024-07-24T18:39:58.219283Z","instanceStatus":{"detailsKind":"CANCELED","displayName":"Canceled"},"source":{"manual":{"actingUser":{"userEmail":"max.gale@datadoghq.com","userName":"Max + Gale","userUuid":"e39535f4-306b-11ee-9383-6ac9a4415a29"}}},"startTimestamp":"2024-07-24T18:38:31.326418Z"},"id":"305a472b-71ab-4ce8-8f8d-75db635627b5","type":"instances"}],"meta":{"canceledCount":1,"failedCount":0,"page":{"totalCount":2,"totalFilteredCount":2},"succeededCount":0}} + + ' + code: 200 + duration: 0ms + headers: + Content-Type: + - application/json + status: 200 OK +version: 2 diff --git a/tests/scenarios/features/v2/undo.json b/tests/scenarios/features/v2/undo.json index 170f9c4e65a..61f6809d5e3 100644 --- a/tests/scenarios/features/v2/undo.json +++ b/tests/scenarios/features/v2/undo.json @@ -2406,5 +2406,29 @@ "undo": { "type": "safe" } + }, + "ListWorkflowInstances": { + "tag": "Workflow Automation", + "undo": { + "type": "safe" + } + }, + "CreateWorkflowInstance": { + "tag": "Workflow Automation", + "undo": { + "type": "safe" + } + }, + "GetWorkflowInstance": { + "tag": "Workflow Automation", + "undo": { + "type": "safe" + } + }, + "CancelWorkflowInstance": { + "tag": "Workflow Automation", + "undo": { + "type": "safe" + } } } diff --git a/tests/scenarios/features/v2/workflow_automation.feature b/tests/scenarios/features/v2/workflow_automation.feature new file mode 100644 index 00000000000..fe979f72dd0 --- /dev/null +++ b/tests/scenarios/features/v2/workflow_automation.feature @@ -0,0 +1,87 @@ +@endpoint(workflow-automation) @endpoint(workflow-automation-v2) +Feature: Workflow Automation + Automate your teams operational processes with Datadog Workflow + Automation. + + Background: + Given a valid "apiKeyAuth" key in the system + And a valid "appKeyAuth" key in the system + And an instance of "WorkflowAutomation" API + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Cancel a workflow instance returns "Bad Request" response + Given new "CancelWorkflowInstance" request + And request contains "workflow_id" parameter with value "malformed" + And request contains "instance_id" parameter with value "malformed" + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Cancel a workflow instance returns "Not Found" response + Given new "CancelWorkflowInstance" request + And request contains "workflow_id" parameter with value "0233a3b7-b7ba-425e-a8cc-375ca2020b5b" + And request contains "instance_id" parameter with value "e0c64dc8-f946-4ae8-8d79-54569031ce67" + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Cancel a workflow instance returns "OK" response + Given new "CancelWorkflowInstance" request + And request contains "workflow_id" parameter with value "ccf73164-1998-4785-a7a3-8d06c7e5f558" + And request contains "instance_id" parameter with value "305a472b-71ab-4ce8-8f8d-75db635627b5" + When the request is sent + Then the response status is 200 OK + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Execute a workflow returns "Bad Request" response + Given new "CreateWorkflowInstance" request + And request contains "workflow_id" parameter with value "malformed" + And body with value { "meta": { "payload": { "input": "value" } } } + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Execute a workflow returns "Created" response + Given new "CreateWorkflowInstance" request + And request contains "workflow_id" parameter with value "ccf73164-1998-4785-a7a3-8d06c7e5f558" + And body with value { "meta": { "payload": { "input": "value" } } } + When the request is sent + Then the response status is 200 Created + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Get a workflow instance returns "Bad Request" response + Given new "GetWorkflowInstance" request + And request contains "workflow_id" parameter with value "malformed" + And request contains "instance_id" parameter with value "malformed" + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Get a workflow instance returns "Not Found" response + Given new "GetWorkflowInstance" request + And request contains "workflow_id" parameter with value "0233a3b7-b7ba-425e-a8cc-375ca2020b5b" + And request contains "instance_id" parameter with value "e0c64dc8-f946-4ae8-8d79-54569031ce67" + When the request is sent + Then the response status is 404 Not Found + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: Get a workflow instance returns "OK" response + Given new "GetWorkflowInstance" request + And request contains "workflow_id" parameter with value "ccf73164-1998-4785-a7a3-8d06c7e5f558" + And request contains "instance_id" parameter with value "305a472b-71ab-4ce8-8f8d-75db635627b5" + When the request is sent + Then the response status is 200 OK + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: List workflow instances returns "Bad Request" response + Given new "ListWorkflowInstances" request + And request contains "workflow_id" parameter with value "malformed" + When the request is sent + Then the response status is 400 Bad Request + + @replay-only @team:DataDog/workflow-automation-dev + Scenario: List workflow instances returns "OK" response + Given new "ListWorkflowInstances" request + And request contains "workflow_id" parameter with value "ccf73164-1998-4785-a7a3-8d06c7e5f558" + When the request is sent + Then the response status is 200 OK