[comment]: # ({35eb8af0-f5d7e62f})
# sla.create

[comment]: # ({/35eb8af0-f5d7e62f})

[comment]: # ({d7447075-c44d5a50})
### 説明

`object sla.create(object/array SLAs)`

このメソッドは新しいSLAオブジェクトを作成します。

::: noteclassic
このメソッドは*管理者*および*スーパ管理者*ユーザータイプでのみ利用可能です。
このメソッドを呼び出す権限はユーザーロールの設定で取り消すことができます。
詳細は[ユーザーロール](/manual/web_interface/frontend_sections/users/user_roles)を参照してください。
:::

[comment]: # ({/d7447075-c44d5a50})

[comment]: # ({bdf1088b-69be5e01})
### パラメータ

`(object/array)` 作成するSLAオブジェクト。

[標準SLAプロパティ](object#sla)に加えて、この
メソッドは以下のパラメータを受け付けます。

|パラメータ|[Type](/manual/api/reference_commentary#data-types)|説明|
|--|--|------|
|service_tags|array|SLA用に作成する[SLAサービスタグ](/manual/api/reference/sla/object#sla-service-tag)。<br><br>[パラメータの動作](/manual/api/reference_commentary#parameter-behavior):<br>- *必須*|
|schedule|array|SLA用に作成する[SLAスケジュール](/manual/api/reference/sla/object#sla-schedule)。<br>空のパラメータを指定した場合は、24x7スケジュールとして解釈されます。<br>デフォルト: 24x7スケジュール。|
|excluded_downtimes|array|SLA用に作成する[SLA除外ダウンタイム](/manual/api/reference/sla/object#sla-excluded-downtime)。|

[comment]: # ({/bdf1088b-69be5e01})

[comment]: # ({49fa241a-f5eb6cfd})
### 戻り値

`(object)` 作成されたSLAのIDを`slaids`プロパティに含むオブジェクトを返します。返されるIDの順序は、渡されたSLAの順序と一致します。

[comment]: # ({/49fa241a-f5eb6cfd})

[comment]: # ({b41637d2-b41637d2})
### 例

[comment]: # ({/b41637d2-b41637d2})

[comment]: # ({4591adda-fc6bed3c})
#### SLAの作成

以下のためにSLAエントリを作成するよう指示します:
* SQLエンジン関連サービスの稼働時間の追跡;
* 土曜日の最終時間を除くすべての平日のカスタムスケジュール;
* 2022年の最終日を有効日とする;
* 7月4日午前0時から1時間15分の計画停止;
* SLAの週次レポート計算を有効にする;
* 最小許容SLOは99.9995%とする。

[comment]: # ({/4591adda-fc6bed3c})

[comment]: # ({ce7393a0-18749288})
[リクエスト](/manual/api#performing-requests):

```json
{
    "jsonrpc": "2.0",
    "method": "sla.create",
    "params": [
        {
            "name": "Database Uptime",
            "slo": "99.9995",
            "period": "1",
            "timezone": "America/Toronto",
            "description": "Provide excellent uptime for main database engines.",
            "effective_date": 1672444800,
            "status": 1,
            "schedule": [
                {
                    "period_from": 0,
                    "period_to": 601200
                }
            ],
            "service_tags": [
                {
                    "tag": "database",
                    "operator": "0",
                    "value": "mysql"
                },
                {
                    "tag": "database",
                    "operator": "0",
                    "value": "postgresql"
                }
            ],
            "excluded_downtimes": [
                {
                    "name": "Software version upgrade rollout",
                    "period_from": "1648760400",
                    "period_to": "1648764900"
                }
            ]
        }
    ],
    "id": 1
}
```

レスポンス:

```json
{
    "jsonrpc": "2.0",
    "result": {
        "slaids": [
            "5"
        ]
    },
    "id": 1
}
```

[comment]: # ({/ce7393a0-18749288})

[comment]: # ({b5a2d850-fda6729e})
### ソース

*ui/include/classes/api/services/CSla.php* の CSla::create()。

[comment]: # ({/b5a2d850-fda6729e})
