> For the complete documentation index, see [llms.txt](https://docs.skyone.cloud/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.skyone.cloud/api-skyone-autosky/api-ambientes.md).

# API Ambientes

Chamadas de API para operação de Ambientes.

{% hint style="info" %}
**Base path:** `/environments/`
{% endhint %}

***

## Listar Ambientes

Listagem de todos os ambientes.

```http
GET /environments/
```

### Resposta

**Status:** `200 OK`

```json
[
    {
        "amb_uuid": "dd2f7c4e-8dee-4ecc-8033-f21207945d55",
        "nome": "Ambiente 1",
        "in_maintenance": false,
        "maintenance_msg": "Em manutenção",
        "schedule_maintenance": false,
        "schedule_maintenance_start": "2020-12-11T03:10:14-03:00",
        "schedule_maintenance_end": "2020-12-12T07:35:15-03:00",
        "schedule_maintenance_msg": "Em manutenção",
        "terminate_sessions": false,
        "terminate_instances": false,
        "schedule_warning": false,
        "schedule_warning_start": "2020-12-24T00:00:00-03:00",
        "schedule_warning_end": "2020-12-25T00:00:00-03:00",
        "schedule_warning_msg": "Feliz Natal!",
        "display_warning_to_logged_users": false,
        "environment_state": "available",
        "preparation_server": {
            "instance_id": "ocid1.instance.oc1...",
            "name": "TEMPLATE_SERVER_NAME",
            "public_ip": "1.2.3.4",
            "private_ip": "4.3.2.1",
            "instance_state": "RUNNING",
            "stop_time": "2021/03/15 19:42:25"
        }
    }
]
```

### Campos do Objeto Ambiente

| Campo                             | Tipo        | Descrição                                         |
| --------------------------------- | ----------- | ------------------------------------------------- |
| `amb_uuid`                        | string      | Identificador único do ambiente                   |
| `nome`                            | string      | Nome do ambiente                                  |
| `in_maintenance`                  | boolean     | Se está em manutenção imediata                    |
| `maintenance_msg`                 | string      | Mensagem de manutenção                            |
| `schedule_maintenance`            | boolean     | Se possui manutenção programada ativa             |
| `schedule_maintenance_start`      | string/null | Data/hora de início da manutenção programada      |
| `schedule_maintenance_end`        | string/null | Data/hora de fim da manutenção programada         |
| `schedule_maintenance_msg`        | string      | Mensagem da manutenção programada                 |
| `terminate_sessions`              | boolean     | Se encerra sessões na manutenção                  |
| `terminate_instances`             | boolean     | Se encerra instâncias na manutenção               |
| `schedule_warning`                | boolean     | Se possui aviso programado ativo                  |
| `schedule_warning_start`          | string/null | Data/hora de início do aviso                      |
| `schedule_warning_end`            | string/null | Data/hora de fim do aviso                         |
| `schedule_warning_msg`            | string      | Mensagem do aviso                                 |
| `display_warning_to_logged_users` | boolean     | Se exibe aviso para usuários já logados           |
| `environment_state`               | string      | Estado do ambiente (ex: `available`)              |
| `preparation_server`              | object/null | Dados do servidor de preparação (pode ser `null`) |

***

## Obter dados de um ambiente

Obtém dados de um ambiente especificado por seu UUID.

```http
GET /environments/{amb_uuid}
```

### Parâmetros de Path

| Parâmetro  | Obrigatório | Descrição        |
| ---------- | ----------- | ---------------- |
| `amb_uuid` | Sim         | UUID do ambiente |

### Resposta

**Status:** `200 OK`

Retorna o objeto do ambiente com a mesma estrutura da listagem.

***

## Ativar / Desativar manutenção imediata

Ativa ou desativa a manutenção imediata em um ambiente completo.

```http
PATCH /environments/{amb_uuid}
```

### Parâmetros de Path

| Parâmetro  | Obrigatório | Descrição        |
| ---------- | ----------- | ---------------- |
| `amb_uuid` | Sim         | UUID do ambiente |

### Body da Requisição

| Campo             | Tipo    | Obrigatório | Descrição                                                 |
| ----------------- | ------- | ----------- | --------------------------------------------------------- |
| `in_maintenance`  | boolean | Sim         | `true` para ativar, `false` para desativar                |
| `maintenance_msg` | string  | Não         | Mensagem apresentada aos usuários durante o próximo login |

### Resposta

**Status:** `200 OK`

Retorna o objeto do ambiente atualizado.

***

## Ativar / Desativar manutenção programada

Ativa ou desativa a manutenção programada em um ambiente completo.

É obrigatório especificar todos os campos abaixo quando `schedule_maintenance` for `true`.

```http
PATCH /environments/{amb_uuid}
```

### Parâmetros de Path

| Parâmetro  | Obrigatório | Descrição        |
| ---------- | ----------- | ---------------- |
| `amb_uuid` | Sim         | UUID do ambiente |

### Body da Requisição

| Campo                        | Tipo    | Obrigatório | Descrição                                                     |
| ---------------------------- | ------- | ----------- | ------------------------------------------------------------- |
| `schedule_maintenance`       | boolean | Sim         | Ativa/desativa manutenção programada                          |
| `schedule_maintenance_start` | string  | Condicional | Data/hora de início. Formato: `2021-12-01T23:10:00.000-03:00` |
| `schedule_maintenance_end`   | string  | Condicional | Data/hora de encerramento                                     |
| `schedule_maintenance_msg`   | string  | Condicional | Mensagem apresentada aos usuários                             |
| `terminate_sessions`         | boolean | Não         | Encerra sessões dos usuários ativos                           |
| `terminate_instances`        | boolean | Não         | Encerra instâncias ativas                                     |

### Resposta

**Status:** `200 OK`

Retorna o objeto do ambiente atualizado.

***

## Ativar / Desativar avisos programados

Ativa ou desativa a exibição programada de avisos em um ambiente completo.

É obrigatório especificar todos os campos abaixo quando `schedule_warning` for `true`.

```http
PATCH /environments/{amb_uuid}
```

### Parâmetros de Path

| Parâmetro  | Obrigatório | Descrição        |
| ---------- | ----------- | ---------------- |
| `amb_uuid` | Sim         | UUID do ambiente |

### Body da Requisição

| Campo                             | Tipo    | Obrigatório | Descrição                            |
| --------------------------------- | ------- | ----------- | ------------------------------------ |
| `schedule_warning`                | boolean | Sim         | Ativa/desativa avisos programados    |
| `schedule_warning_start`          | string  | Condicional | Data/hora de início                  |
| `schedule_warning_end`            | string  | Condicional | Data/hora de encerramento            |
| `schedule_warning_msg`            | string  | Condicional | Mensagem do aviso                    |
| `display_warning_to_logged_users` | boolean | Condicional | Exibe aviso para usuários já logados |

### Resposta

**Status:** `200 OK`

Retorna o objeto do ambiente atualizado.


---

# 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://docs.skyone.cloud/api-skyone-autosky/api-ambientes.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.
