Skip to content

Latest commit

 

History

History
880 lines (702 loc) · 58.8 KB

File metadata and controls

880 lines (702 loc) · 58.8 KB

Workflows

Overview

Available Operations

List

Get a list of all Workflows

Example Usage

package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/operations"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.List(ctx, operations.WorkflowsListWorkflowsRequest{
        OwnerID: "<id>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.V3WorkflowsListWorkflowAPIResponse != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request operations.WorkflowsListWorkflowsRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.WorkflowsListWorkflowsResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestError 400 application/json
apierrors.UnauthorizedError 401 application/json
apierrors.PaymentRequiredError 402 application/json
apierrors.ForbiddenError 403 application/json
apierrors.NotFoundError 404 application/json
apierrors.ConflictError 409 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.BadGatewayError 502 application/json
apierrors.ServiceUnavailableError 503 application/json
apierrors.GatewayTimeoutError 504 application/json
apierrors.APIError 4XX, 5XX */*

Create

Create a Workflow

Example Usage

package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.Create(ctx, components.V3WorkflowsCreateWorkflowRequest{
        Title: "<value>",
        OwnerID: "<id>",
        Trigger: components.V3WorkflowsWorkflowTriggerIncidentAcknowledged,
        Filters: components.V3WorkflowsCreateWorkflowFilter{},
        Actions: []components.V3WorkflowsActionRequest{
            components.CreateV3WorkflowsActionRequestV3WorkflowsSqTriggerManualWebhook(
                components.V3WorkflowsSqTriggerManualWebhook{
                    Name: components.V3WorkflowsSqTriggerManualWebhookNameSqTriggerManualWebhook,
                    Data: components.V3WorkflowsSqTriggerManualWebhookData{
                        ID: "<id>",
                    },
                },
            ),
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request components.V3WorkflowsCreateWorkflowRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.WorkflowsCreateWorkflowResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestError 400 application/json
apierrors.UnauthorizedError 401 application/json
apierrors.PaymentRequiredError 402 application/json
apierrors.ForbiddenError 403 application/json
apierrors.NotFoundError 404 application/json
apierrors.ConflictError 409 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.BadGatewayError 502 application/json
apierrors.ServiceUnavailableError 503 application/json
apierrors.GatewayTimeoutError 504 application/json
apierrors.APIError 4XX, 5XX */*

BulkEnableDisable

Bulk enable or disable workflows

Example Usage

package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.BulkEnableDisable(ctx, components.V3WorkflowsBulkEnableDisableWorkflowsRequest{
        OwnerID: "<id>",
        Enabled: false,
        WorkflowIds: []int{
            124939,
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
request components.V3WorkflowsBulkEnableDisableWorkflowsRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.WorkflowsBulkEnabledisableWorkflowsResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestError 400 application/json
apierrors.UnauthorizedError 401 application/json
apierrors.PaymentRequiredError 402 application/json
apierrors.ForbiddenError 403 application/json
apierrors.NotFoundError 404 application/json
apierrors.ConflictError 409 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.BadGatewayError 502 application/json
apierrors.ServiceUnavailableError 503 application/json
apierrors.GatewayTimeoutError 504 application/json
apierrors.APIError 4XX, 5XX */*

Delete

Delete a workflow by ID

Example Usage

package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.Delete(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workflowID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.WorkflowsDeleteWorkflowResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestError 400 application/json
apierrors.UnauthorizedError 401 application/json
apierrors.PaymentRequiredError 402 application/json
apierrors.ForbiddenError 403 application/json
apierrors.NotFoundError 404 application/json
apierrors.ConflictError 409 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.BadGatewayError 502 application/json
apierrors.ServiceUnavailableError 503 application/json
apierrors.GatewayTimeoutError 504 application/json
apierrors.APIError 4XX, 5XX */*

GetByID

Get a workflow by ID

Example Usage

package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.GetByID(ctx, "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.V3WorkflowsGetWorkflowByIDResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workflowID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.WorkflowsGetWorkflowByIDResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestError 400 application/json
apierrors.UnauthorizedError 401 application/json
apierrors.PaymentRequiredError 402 application/json
apierrors.ForbiddenError 403 application/json
apierrors.NotFoundError 404 application/json
apierrors.ConflictError 409 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.BadGatewayError 502 application/json
apierrors.ServiceUnavailableError 503 application/json
apierrors.GatewayTimeoutError 504 application/json
apierrors.APIError 4XX, 5XX */*

Update

Update a Workflow

Example Usage

package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.Update(ctx, "<id>", components.V3WorkflowsCreateWorkflowRequestUpdate{})
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workflowID string ✔️ N/A
v3WorkflowsCreateWorkflowRequestUpdate components.V3WorkflowsCreateWorkflowRequestUpdate ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.WorkflowsUpdateWorkflowResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestError 400 application/json
apierrors.UnauthorizedError 401 application/json
apierrors.PaymentRequiredError 402 application/json
apierrors.ForbiddenError 403 application/json
apierrors.NotFoundError 404 application/json
apierrors.ConflictError 409 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.BadGatewayError 502 application/json
apierrors.ServiceUnavailableError 503 application/json
apierrors.GatewayTimeoutError 504 application/json
apierrors.APIError 4XX, 5XX */*

UpdateActionsOrder

Update action order in a workflow

Example Usage

package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.UpdateActionsOrder(ctx, "<id>", components.V3WorkflowsUpdateActionsOrderRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.V3WorkflowsUpdateActionsOrderResponse != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workflowID string ✔️ N/A
v3WorkflowsUpdateActionsOrderRequest components.V3WorkflowsUpdateActionsOrderRequest ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.WorkflowsUpdateActionsOrderResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestError 400 application/json
apierrors.UnauthorizedError 401 application/json
apierrors.PaymentRequiredError 402 application/json
apierrors.ForbiddenError 403 application/json
apierrors.NotFoundError 404 application/json
apierrors.ConflictError 409 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.BadGatewayError 502 application/json
apierrors.ServiceUnavailableError 503 application/json
apierrors.GatewayTimeoutError 504 application/json
apierrors.APIError 4XX, 5XX */*

DeleteAction

Delete an action by action ID

Example Usage

package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.DeleteAction(ctx, "<id>", "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workflowID string ✔️ N/A
actionID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.WorkflowsDeleteWorkflowActionResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestError 400 application/json
apierrors.UnauthorizedError 401 application/json
apierrors.PaymentRequiredError 402 application/json
apierrors.ForbiddenError 403 application/json
apierrors.NotFoundError 404 application/json
apierrors.ConflictError 409 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.BadGatewayError 502 application/json
apierrors.ServiceUnavailableError 503 application/json
apierrors.GatewayTimeoutError 504 application/json
apierrors.APIError 4XX, 5XX */*

GetAction

Get workflow action by ID

Example Usage

package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.GetAction(ctx, "<id>", "<id>")
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workflowID string ✔️ N/A
actionID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.WorkflowsGetWorkflowActionByIDResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestError 400 application/json
apierrors.UnauthorizedError 401 application/json
apierrors.PaymentRequiredError 402 application/json
apierrors.ForbiddenError 403 application/json
apierrors.NotFoundError 404 application/json
apierrors.ConflictError 409 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.BadGatewayError 502 application/json
apierrors.ServiceUnavailableError 503 application/json
apierrors.GatewayTimeoutError 504 application/json
apierrors.APIError 4XX, 5XX */*

UpdateAction

Update an action by action ID

Example Usage

package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
	"github.com/solarwinds/squadcast-sdk-go/models/operations"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.UpdateAction(ctx, "<id>", "<id>", components.CreateV3WorkflowsActionRequestUpdateAny(
        map[string]any{
            "name": "slack_message_channel",
        },
    ))
    if err != nil {
        log.Fatal(err)
    }
    if res.OneOf != nil {
        switch res.OneOf.Type {
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeSqAttachRunbooks:
                // res.OneOf.SqAttachRunbooks is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqMarkIncidentSLOAffecting:
                // res.OneOf.V3WorkflowsSqMarkIncidentSLOAffecting is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqTriggerManualWebhook:
                // res.OneOf.V3WorkflowsSqTriggerManualWebhook is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsUpdateIncidentPriority:
                // res.OneOf.V3WorkflowsUpdateIncidentPriority is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqCreateStatusPageIssue:
                // res.OneOf.V3WorkflowsSqCreateStatusPageIssue is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqAddIncidentNote:
                // res.OneOf.V3WorkflowsSqAddIncidentNote is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSlackArchiveChannel:
                // res.OneOf.V3WorkflowsSlackArchiveChannel is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqAddCommunicationChannel:
                // res.OneOf.V3WorkflowsSqAddCommunicationChannel is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSlackMessageChannel:
                // res.OneOf.V3WorkflowsSlackMessageChannel is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSlackMessageUser:
                // res.OneOf.V3WorkflowsSlackMessageUser is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqMakeHTTPCall:
                // res.OneOf.V3WorkflowsSqMakeHTTPCall is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSlackCreateIncidentChannel:
                // res.OneOf.V3WorkflowsSlackCreateIncidentChannel is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsJiraCreateTicket:
                // res.OneOf.V3WorkflowsJiraCreateTicket is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsMsTeamsMessageChannel:
                // res.OneOf.V3WorkflowsMsTeamsMessageChannel is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsMsTeamsMessageUser:
                // res.OneOf.V3WorkflowsMsTeamsMessageUser is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsSqSendEmail:
                // res.OneOf.V3WorkflowsSqSendEmail is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeV3WorkflowsMsTeamsCreateMeetingLink:
                // res.OneOf.V3WorkflowsMsTeamsCreateMeetingLink is populated
            case operations.WorkflowsUpdateWorkflowActionResponseBodyTypeAny:
                // res.OneOf.Any is populated
        }

    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workflowID string ✔️ N/A
actionID string ✔️ N/A
v3WorkflowsActionRequestUpdate components.V3WorkflowsActionRequestUpdate ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.WorkflowsUpdateWorkflowActionResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestError 400 application/json
apierrors.UnauthorizedError 401 application/json
apierrors.PaymentRequiredError 402 application/json
apierrors.ForbiddenError 403 application/json
apierrors.NotFoundError 404 application/json
apierrors.ConflictError 409 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.BadGatewayError 502 application/json
apierrors.ServiceUnavailableError 503 application/json
apierrors.GatewayTimeoutError 504 application/json
apierrors.APIError 4XX, 5XX */*

ToggleEnable

Enable or disable workflow by ID

Example Usage

package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"github.com/solarwinds/squadcast-sdk-go/models/components"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.ToggleEnable(ctx, "<id>", components.V3WorkflowsEnableDisableWorkflowRequest{})
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != nil {
        // handle response
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workflowID string ✔️ N/A
v3WorkflowsEnableDisableWorkflowRequest components.V3WorkflowsEnableDisableWorkflowRequest ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.WorkflowsEnabledisableWorkflowResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestError 400 application/json
apierrors.UnauthorizedError 401 application/json
apierrors.PaymentRequiredError 402 application/json
apierrors.ForbiddenError 403 application/json
apierrors.NotFoundError 404 application/json
apierrors.ConflictError 409 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.BadGatewayError 502 application/json
apierrors.ServiceUnavailableError 503 application/json
apierrors.GatewayTimeoutError 504 application/json
apierrors.APIError 4XX, 5XX */*

GetLogs

Get workflow logs

Example Usage

package main

import(
	"context"
	"os"
	squadcastsdk "github.com/solarwinds/squadcast-sdk-go"
	"log"
)

func main() {
    ctx := context.Background()

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_AUTH")),
    )

    res, err := s.Workflows.GetLogs(ctx, "<id>", nil, nil)
    if err != nil {
        log.Fatal(err)
    }
    if res.V3WorkflowsGetWorkflowLogsResponse != nil {
        for {
            // handle items

            res, err = res.Next()

            if err != nil {
                // handle error
            }

            if res == nil {
                break
            }
        }
    }
}

Parameters

Parameter Type Required Description
ctx context.Context ✔️ The context to use for the request.
workflowID string ✔️ N/A
pageSize *int64 N/A
pageNumber *int64 N/A
opts []operations.Option The options for this request.

Response

*operations.WorkflowsGetWorkflowLogsResponse, error

Errors

Error Type Status Code Content Type
apierrors.BadRequestError 400 application/json
apierrors.UnauthorizedError 401 application/json
apierrors.PaymentRequiredError 402 application/json
apierrors.ForbiddenError 403 application/json
apierrors.NotFoundError 404 application/json
apierrors.ConflictError 409 application/json
apierrors.UnprocessableEntityError 422 application/json
apierrors.InternalServerError 500 application/json
apierrors.BadGatewayError 502 application/json
apierrors.ServiceUnavailableError 503 application/json
apierrors.GatewayTimeoutError 504 application/json
apierrors.APIError 4XX, 5XX */*