Skip to content

Latest commit

 

History

History
526 lines (424 loc) · 32.3 KB

File metadata and controls

526 lines (424 loc) · 32.3 KB

Slos

(Slos)

Overview

Available Operations

ListAll

Returns all the SLOs of the passed owner_id in the params. Requires access_token as a Bearer {{token}} in the Authorization header with read scope.

Example Usage

package main

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

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

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

    res, err := s.Slos.ListAll(ctx, "<id>", "<value>", "<value>")
    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.
ownerID string ✔️ N/A
offset string ✔️ N/A
limit string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.SLOGetAllSLOsResponse, 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

  • This API will create SLO. Requires access_token as a Bearer {{token}} in the Authorization header with user-write scope.

Example Usage

package main

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

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

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

    res, err := s.Slos.Create(ctx, components.V3SLOCreateSLORequest{
        Name: "<value>",
        TimeIntervalType: components.V3SLOTimeIntervalTypeRolling,
        ServiceIds: []string{
            "<value 1>",
        },
        Slis: []string{},
        TargetSlo: 6924.37,
        StartTime: types.MustTimeFromString("2023-06-03T10:41:05.981Z"),
        EndTime: types.MustTimeFromString("2023-11-20T07:09:22.422Z"),
        DurationInDays: 574042,
        OwnerType: "<value>",
        OwnerID: "<id>",
        SloOwnerID: "<id>",
        SloOwnerType: components.V3SLOSLOOwnerTypeSquad,
    })
    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.V3SLOCreateSLORequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.SLOCreateSLOResponse, 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

  • This API will update SLO. Requires access_token as a Bearer {{token}} in the Authorization header with user-write scope.

Example Usage

package main

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

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

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

    res, err := s.Slos.Update(ctx, 16112, "<id>", components.V3SLOCreateSLORequest{
        Name: "<value>",
        TimeIntervalType: components.V3SLOTimeIntervalTypeRolling,
        ServiceIds: []string{
            "<value 1>",
            "<value 2>",
            "<value 3>",
        },
        Slis: []string{
            "<value 1>",
        },
        TargetSlo: 2464.03,
        StartTime: types.MustTimeFromString("2025-10-31T03:29:37.701Z"),
        EndTime: types.MustTimeFromString("2024-03-30T19:04:36.297Z"),
        DurationInDays: 271064,
        OwnerType: "<value>",
        OwnerID: "<id>",
        SloOwnerID: "<id>",
        SloOwnerType: components.V3SLOSLOOwnerTypeUser,
    })
    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.
sloID int64 ✔️ N/A
ownerID string ✔️ N/A
v3SLOCreateSLORequest components.V3SLOCreateSLORequest ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.SLOUpdateSLOResponse, 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 */*

Remove

Remove SLO from passed owner_id (team_id) in the params . Upon sccess the slo will be removed. Requires access_token as a Bearer {{token}} in the Authorization header with user-write scope.

Example Usage

package main

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

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

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

    res, err := s.Slos.Remove(ctx, 938544, "<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.
sloID int64 ✔️ N/A
ownerID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.SLORemoveSLOResponse, 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

Returns a SLO details of the given sloID in the request param. Requires access_token as a Bearer {{token}} in the Authorization header with read scope.

Example Usage

package main

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

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

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

    res, err := s.Slos.GetByID(ctx, 586718, "<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.
sloID int64 ✔️ N/A
ownerID string ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.SLOGetSLOByIDResponse, 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 */*

MarkAffected

This endpoint is used for mark slo affected.

Requires access_token as a Bearer {{token}} in the Authorization header with user-write scope.

Example Usage

package main

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

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

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

    res, err := s.Slos.MarkAffected(ctx, 294670, "<id>", components.V3SLOMarkSLOAffectedRequest{
        IncidentID: "<id>",
        Slis: []string{
            "<value 1>",
            "<value 2>",
        },
        ErrorBudgetSpent: 3480.26,
        OwnerType: "<value>",
        OwnerID: "<id>",
        OrgID: "<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.
sloID int64 ✔️ N/A
ownerID string ✔️ N/A
v3SLOMarkSLOAffectedRequest components.V3SLOMarkSLOAffectedRequest ✔️ N/A
opts []operations.Option The options for this request.

Response

*operations.SLOMarkSLOAffectedResponse, 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 */*

MarkFalsePositive

Value is a boolean (true or false)

Example Usage

package main

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

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

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

    res, err := s.Slos.MarkFalsePositive(ctx, operations.SLOMarkSLOFalsePositiveRequest{
        SloID: 825843,
        IncidentID: 505067,
        Value: true,
        OwnerID: "<id>",
        RequestBody: operations.SLOMarkSLOFalsePositiveRequestBody{},
    })
    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 operations.SLOMarkSLOFalsePositiveRequest ✔️ The request object to use for the request.
opts []operations.Option The options for this request.

Response

*operations.SLOMarkSLOFalsePositiveResponse, 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 */*