> For the complete documentation index, see [llms.txt](https://developers.incidents.cloud.solarwinds.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/sdks/rulesetsrules.md).

# GlobalEventRules.Rulesets.Rules

## Overview

### Available Operations

* [list](#list) - List Ruleset Rules
* [create](#create) - Create Rule
* [get\_by\_id](#get_by_id) - Get Rule by ID
* [update\_by\_id](#update_by_id) - Update Rule by ID
* [reorder](#reorder) - Reorder Ruleset By Index

## list

Get all rules of a GER Ruleset.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.global_event_rules.rulesets.rules.list(ger_id=894010, alert_source_version="<value>", alert_source_shortname="<value>")

    while res is not None:
        # Handle items

        res = res.next()

```

### Parameters

| Parameter                | Type                                                                          | Required             | Description                                                         |
| ------------------------ | ----------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------- |
| `ger_id`                 | *int*                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `alert_source_version`   | *str*                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `alert_source_shortname` | *str*                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `page_size`              | *Optional\[int]*                                                              | :heavy\_minus\_sign: | N/A                                                                 |
| `page_number`            | *Optional\[int]*                                                              | :heavy\_minus\_sign: | N/A                                                                 |
| `filters_search`         | *Optional\[str]*                                                              | :heavy\_minus\_sign: | N/A                                                                 |
| `retries`                | [Optional\[utils.RetryConfig\]](/python-sdk/docs/models/utils/retryconfig.md) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.GlobalEventRulesListRulesetRulesResponse**](/python-sdk/docs/models/globaleventruleslistrulesetrulesresponse.md)

### Errors

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

## create

Create a GER Ruleset Rule.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.global_event_rules.rulesets.rules.create(ger_id=934313, alert_source_version="<value>", alert_source_shortname="<value>", description="ha newsprint within beside scientific", expression="<value>", action={
        "route_to": "<value>",
    })

    # Handle response
    print(res)

```

### Parameters

| Parameter                | Type                                                                                           | Required             | Description                                                         |
| ------------------------ | ---------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------- |
| `ger_id`                 | *int*                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `alert_source_version`   | *str*                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `alert_source_shortname` | *str*                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `description`            | *str*                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `expression`             | *str*                                                                                          | :heavy\_check\_mark: | N/A                                                                 |
| `action`                 | [models.V3GlobalEventRulesRuleAction](/python-sdk/docs/models/v3globaleventrulesruleaction.md) | :heavy\_check\_mark: | N/A                                                                 |
| `retries`                | [Optional\[utils.RetryConfig\]](/python-sdk/docs/models/utils/retryconfig.md)                  | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.GlobalEventRulesCreateRuleResponse**](/python-sdk/docs/models/globaleventrulescreateruleresponse.md)

### Errors

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

## get\_by\_id

Get a GER Ruleset Rule by its ID.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.global_event_rules.rulesets.rules.get_by_id(ger_id=518804, alert_source_version="<value>", alert_source_shortname="<value>", rule_id="<id>")

    # Handle response
    print(res)

```

### Parameters

| Parameter                | Type                                                                          | Required             | Description                                                         |
| ------------------------ | ----------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------- |
| `ger_id`                 | *int*                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `alert_source_version`   | *str*                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `alert_source_shortname` | *str*                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `rule_id`                | *str*                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `retries`                | [Optional\[utils.RetryConfig\]](/python-sdk/docs/models/utils/retryconfig.md) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.GlobalEventRulesGetRuleByIDResponse**](/python-sdk/docs/models/globaleventrulesgetrulebyidresponse.md)

### Errors

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

## update\_by\_id

Update a GER Ruleset Rule by its ID.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.global_event_rules.rulesets.rules.update_by_id(ger_id=140241, alert_source_version="<value>", alert_source_shortname="<value>", rule_id="<id>")

    # Handle response
    print(res)

```

### Parameters

| Parameter                | Type                                                                                                                   | Required             | Description                                                         |
| ------------------------ | ---------------------------------------------------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------- |
| `ger_id`                 | *int*                                                                                                                  | :heavy\_check\_mark: | N/A                                                                 |
| `alert_source_version`   | *str*                                                                                                                  | :heavy\_check\_mark: | N/A                                                                 |
| `alert_source_shortname` | *str*                                                                                                                  | :heavy\_check\_mark: | N/A                                                                 |
| `rule_id`                | *str*                                                                                                                  | :heavy\_check\_mark: | N/A                                                                 |
| `description`            | *Optional\[str]*                                                                                                       | :heavy\_minus\_sign: | N/A                                                                 |
| `expression`             | *Optional\[str]*                                                                                                       | :heavy\_minus\_sign: | N/A                                                                 |
| `action`                 | [Optional\[models.V3GlobalEventRulesRuleActionUpdate\]](/python-sdk/docs/models/v3globaleventrulesruleactionupdate.md) | :heavy\_minus\_sign: | N/A                                                                 |
| `retries`                | [Optional\[utils.RetryConfig\]](/python-sdk/docs/models/utils/retryconfig.md)                                          | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.GlobalEventRulesUpdateRuleByIDResponse**](/python-sdk/docs/models/globaleventrulesupdaterulebyidresponse.md)

### Errors

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

## reorder

Reorder a GER Ruleset Rule by its index in the ruleset.

### Example Usage

```python
from squadcast import SquadcastSDK


with SquadcastSDK(
    refresh_token_auth="<YOUR_REFRESH_TOKEN_AUTH_HERE>",
) as squadcast_sdk:

    res = squadcast_sdk.global_event_rules.rulesets.rules.reorder(ger_id=281260, alert_source_version="<value>", alert_source_shortname="<value>", rule_id="<id>")

    # Handle response
    print(res)

```

### Parameters

| Parameter                | Type                                                                          | Required             | Description                                                         |
| ------------------------ | ----------------------------------------------------------------------------- | -------------------- | ------------------------------------------------------------------- |
| `ger_id`                 | *int*                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `alert_source_version`   | *str*                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `alert_source_shortname` | *str*                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `rule_id`                | *str*                                                                         | :heavy\_check\_mark: | N/A                                                                 |
| `shift_to`               | *Optional\[str]*                                                              | :heavy\_minus\_sign: | N/A                                                                 |
| `shift_index_by`         | *Optional\[int]*                                                              | :heavy\_minus\_sign: | N/A                                                                 |
| `retries`                | [Optional\[utils.RetryConfig\]](/python-sdk/docs/models/utils/retryconfig.md) | :heavy\_minus\_sign: | Configuration to override the default retry behavior of the client. |

### Response

[**models.GlobalEventRulesReorderRulesetByIndexResponse**](/python-sdk/docs/models/globaleventrulesreorderrulesetbyindexresponse.md)

### Errors

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://developers.incidents.cloud.solarwinds.com/python-sdk/docs/sdks/rulesetsrules.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
