# GlobalEventRules

## Overview

### Available Operations

* [List](#list) - List Global Event Rules
* [Create](#create) - Create Global Event Rule
* [DeleteRule](#deleterule) - Delete Global Event Rule by ID
* [GetByID](#getbyid) - Get Global Event Rule by ID
* [UpdateByID](#updatebyid) - Update Global Event Rule by ID
* [GetRuleset](#getruleset) - Get Ruleset
* [UpdateRuleset](#updateruleset) - Update Ruleset
* [UpdateRule](#updaterule) - Update Rule by ID

## List

Get a list of all GERs

### 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.GlobalEventRules.List(ctx, operations.GlobalEventRulesListGlobalEventRulesRequest{
        OwnerID: "<id>",
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.Object != 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](https://pkg.go.dev/context#Context)                                                                                   | :heavy\_check\_mark: | The context to use for the request.        |
| `request` | [operations.GlobalEventRulesListGlobalEventRulesRequest](/go-sdk/docs/models/operations/globaleventruleslistglobaleventrulesrequest.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.GlobalEventRulesListGlobalEventRulesResponse**](/go-sdk/docs/models/operations/globaleventruleslistglobaleventrulesresponse.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

Create a GER

### 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.GlobalEventRules.Create(ctx, components.V3GlobalEventRulesCreateGlobalEventRuleRequest{
        Name: "<value>",
        Description: "majestically effector headline dampen eek middle like shrill",
        OwnerID: "<id>",
        EntityOwner: components.V3GlobalEventRulesEntityOwner{
            ID: "<id>",
            Type: components.V3GlobalEventRulesEntityOwnerTypeUser,
        },
    })
    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.V3GlobalEventRulesCreateGlobalEventRuleRequest](/go-sdk/docs/models/components/v3globaleventrulescreateglobaleventrulerequest.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.GlobalEventRulesCreateGlobalEventRuleResponse**](/go-sdk/docs/models/operations/globaleventrulescreateglobaleventruleresponse.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    | \*/\*            |

## DeleteRule

Delete a GER by its ID

### 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.GlobalEventRules.DeleteRule(ctx, 491102)
    if err != nil {
        log.Fatal(err)
    }
    if res.Body != 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. |
| `gerID`   | `int64`                                                          | :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.GlobalEventRulesDeleteGlobalEventRuleByIDResponse**](/go-sdk/docs/models/operations/globaleventrulesdeleteglobaleventrulebyidresponse.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

Get a GER by its ID

### 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.GlobalEventRules.GetByID(ctx, 292040)
    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. |
| `gerID`   | `int64`                                                          | :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.GlobalEventRulesGetGlobalEventRuleByIDResponse**](/go-sdk/docs/models/operations/globaleventrulesgetglobaleventrulebyidresponse.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    | \*/\*            |

## UpdateByID

Update a GER by its ID

### 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.GlobalEventRules.UpdateByID(ctx, 885894, components.V3GlobalEventRulesUpdateGlobalEventRuleRequest{})
    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. |
| `gerID`                                          | `int64`                                                                                                                                       | :heavy\_check\_mark: | N/A                                 |
| `v3GlobalEventRulesUpdateGlobalEventRuleRequest` | [components.V3GlobalEventRulesUpdateGlobalEventRuleRequest](/go-sdk/docs/models/components/v3globaleventrulesupdateglobaleventrulerequest.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.GlobalEventRulesUpdateGlobalEventRuleByIDResponse**](/go-sdk/docs/models/operations/globaleventrulesupdateglobaleventrulebyidresponse.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    | \*/\*            |

## GetRuleset

Get a GER Ruleset

### 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.GlobalEventRules.GetRuleset(ctx, 294223, "<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. |
| `gerID`                | `int64`                                                          | :heavy\_check\_mark: | N/A                                 |
| `alertSourceVersion`   | `string`                                                         | :heavy\_check\_mark: | N/A                                 |
| `alertSourceShortname` | `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.GlobalEventRulesGetRulesetResponse**](/go-sdk/docs/models/operations/globaleventrulesgetrulesetresponse.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    | \*/\*            |

## UpdateRuleset

Update a GER Ruleset

### 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.GlobalEventRules.UpdateRuleset(ctx, 489958, "<value>", "<value>", components.V3GlobalEventRulesUpdateRulesetRequest{})
    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. |
| `gerID`                                  | `int64`                                                                                                                       | :heavy\_check\_mark: | N/A                                 |
| `alertSourceVersion`                     | `string`                                                                                                                      | :heavy\_check\_mark: | N/A                                 |
| `alertSourceShortname`                   | `string`                                                                                                                      | :heavy\_check\_mark: | N/A                                 |
| `v3GlobalEventRulesUpdateRulesetRequest` | [components.V3GlobalEventRulesUpdateRulesetRequest](/go-sdk/docs/models/components/v3globaleventrulesupdaterulesetrequest.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.GlobalEventRulesUpdateRulesetResponse**](/go-sdk/docs/models/operations/globaleventrulesupdaterulesetresponse.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    | \*/\*            |

## UpdateRule

Update a GER Ruleset Rule by its ID.

### 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/models/operations"
	"log"
)

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

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

    res, err := s.GlobalEventRules.UpdateRule(ctx, operations.GlobalEventRulesUpdateRuleByIDRequest{
        GerID: 140241,
        AlertSourceVersion: "<value>",
        AlertSourceShortname: "<value>",
        RuleID: "<id>",
        V3GlobalEventRulesUpdateRuleRequest: components.V3GlobalEventRulesUpdateRuleRequest{},
    })
    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.GlobalEventRulesUpdateRuleByIDRequest](/go-sdk/docs/models/operations/globaleventrulesupdaterulebyidrequest.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.GlobalEventRulesUpdateRuleByIDResponse**](/go-sdk/docs/models/operations/globaleventrulesupdaterulebyidresponse.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/globaleventrules.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.
