# Slos

## Overview

### Available Operations

* [ListAll](#listall) - Get All SLOs
* [Create](#create) - Create SLO
* [Update](#update) - Update SLO
* [Remove](#remove) - Remove SLO
* [GetByID](#getbyid) - Get SLO By ID
* [MarkAffected](#markaffected) - Mark SLO Affected
* [MarkFalsePositive](#markfalsepositive) - Mark SLO False Positive

## 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

```go
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.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](https://pkg.go.dev/context#Context)            | :heavy\_check\_mark: | The context to use for the request. |
| `ownerID` | `string`                                                         | :heavy\_check\_mark: | N/A                                 |
| `offset`  | `string`                                                         | :heavy\_check\_mark: | N/A                                 |
| `limit`   | `string`                                                         | :heavy\_check\_mark: | N/A                                 |
| `opts`    | \[][operations.Option](/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.SLOGetAllSLOsResponse**](/go-sdk/docs/models/operations/slogetallslosresponse.md)**, 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

```go
package main

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

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

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_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](https://pkg.go.dev/context#Context)                                       | :heavy\_check\_mark: | The context to use for the request.        |
| `request` | [components.V3SLOCreateSLORequest](/go-sdk/docs/models/components/v3slocreateslorequest.md) | :heavy\_check\_mark: | The request object to use for the request. |
| `opts`    | \[][operations.Option](/go-sdk/docs/models/operations/option.md)                            | :heavy\_minus\_sign: | The options for this request.              |

### Response

[**\*operations.SLOCreateSLOResponse**](/go-sdk/docs/models/operations/slocreatesloresponse.md)**, 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

```go
package main

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

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

    s := squadcastsdk.New(
        squadcastsdk.WithSecurity(os.Getenv("SQUADCASTSDK_REFRESH_TOKEN_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](https://pkg.go.dev/context#Context)                                       | :heavy\_check\_mark: | The context to use for the request. |
| `sloID`                 | `int64`                                                                                     | :heavy\_check\_mark: | N/A                                 |
| `ownerID`               | `string`                                                                                    | :heavy\_check\_mark: | N/A                                 |
| `v3SLOCreateSLORequest` | [components.V3SLOCreateSLORequest](/go-sdk/docs/models/components/v3slocreateslorequest.md) | :heavy\_check\_mark: | N/A                                 |
| `opts`                  | \[][operations.Option](/go-sdk/docs/models/operations/option.md)                            | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.SLOUpdateSLOResponse**](/go-sdk/docs/models/operations/sloupdatesloresponse.md)**, 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

```go
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.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](https://pkg.go.dev/context#Context)            | :heavy\_check\_mark: | The context to use for the request. |
| `sloID`   | `int64`                                                          | :heavy\_check\_mark: | N/A                                 |
| `ownerID` | `string`                                                         | :heavy\_check\_mark: | N/A                                 |
| `opts`    | \[][operations.Option](/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.SLORemoveSLOResponse**](/go-sdk/docs/models/operations/sloremovesloresponse.md)**, 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

```go
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.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](https://pkg.go.dev/context#Context)            | :heavy\_check\_mark: | The context to use for the request. |
| `sloID`   | `int64`                                                          | :heavy\_check\_mark: | N/A                                 |
| `ownerID` | `string`                                                         | :heavy\_check\_mark: | N/A                                 |
| `opts`    | \[][operations.Option](/go-sdk/docs/models/operations/option.md) | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.SLOGetSLOByIDResponse**](/go-sdk/docs/models/operations/slogetslobyidresponse.md)**, 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

```go
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.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](https://pkg.go.dev/context#Context)                                                   | :heavy\_check\_mark: | The context to use for the request. |
| `sloID`                       | `int64`                                                                                                 | :heavy\_check\_mark: | N/A                                 |
| `ownerID`                     | `string`                                                                                                | :heavy\_check\_mark: | N/A                                 |
| `v3SLOMarkSLOAffectedRequest` | [components.V3SLOMarkSLOAffectedRequest](/go-sdk/docs/models/components/v3slomarksloaffectedrequest.md) | :heavy\_check\_mark: | N/A                                 |
| `opts`                        | \[][operations.Option](/go-sdk/docs/models/operations/option.md)                                        | :heavy\_minus\_sign: | The options for this request.       |

### Response

[**\*operations.SLOMarkSLOAffectedResponse**](/go-sdk/docs/models/operations/slomarksloaffectedresponse.md)**, 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

```go
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.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](https://pkg.go.dev/context#Context)                                                         | :heavy\_check\_mark: | The context to use for the request.        |
| `request` | [operations.SLOMarkSLOFalsePositiveRequest](/go-sdk/docs/models/operations/slomarkslofalsepositiverequest.md) | :heavy\_check\_mark: | The request object to use for the request. |
| `opts`    | \[][operations.Option](/go-sdk/docs/models/operations/option.md)                                              | :heavy\_minus\_sign: | The options for this request.              |

### Response

[**\*operations.SLOMarkSLOFalsePositiveResponse**](/go-sdk/docs/models/operations/slomarkslofalsepositiveresponse.md)**, 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    | \*/\*            |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://developers.incidents.cloud.solarwinds.com/go-sdk/docs/sdks/slos.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
