environments
Creates, updates, deletes, gets or lists an environments
resource.
Overview
Name | environments |
Type | Resource |
Id | google.composer.environments |
Fields
The following fields are returned by SELECT
queries:
- get
- list
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Identifier. The resource name of the environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}" EnvironmentId must start with a lowercase letter followed by up to 63 lowercase letters, numbers, or hyphens, and cannot end with a hyphen. |
config | object | Optional. Configuration parameters for this environment. (id: EnvironmentConfig) |
createTime | string (google-datetime) | Output only. The time at which this environment was created. |
labels | object | Optional. User-defined labels for this environment. The labels map can contain no more than 64 entries. Entries of the labels map are UTF8 strings that comply with the following restrictions: * Keys must conform to regexp: \p{Ll}\p{Lo}{0,62} * Values must conform to regexp: [\p{Ll}\p{Lo}\p{N}_-]{0,63} * Both keys and values are additionally constrained to be <= 128 bytes in size. |
satisfiesPzi | boolean | Output only. Reserved for future use. |
satisfiesPzs | boolean | Output only. Reserved for future use. |
state | string | The current state of the environment. |
storageConfig | object | Optional. Storage configuration for this environment. (id: StorageConfig) |
updateTime | string (google-datetime) | Output only. The time at which this environment was last modified. |
uuid | string | Output only. The UUID (Universally Unique IDentifier) associated with this environment. This value is generated when the environment is created. |
Successful response
Name | Datatype | Description |
---|---|---|
name | string | Identifier. The resource name of the environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}" EnvironmentId must start with a lowercase letter followed by up to 63 lowercase letters, numbers, or hyphens, and cannot end with a hyphen. |
config | object | Optional. Configuration parameters for this environment. (id: EnvironmentConfig) |
createTime | string (google-datetime) | Output only. The time at which this environment was created. |
labels | object | Optional. User-defined labels for this environment. The labels map can contain no more than 64 entries. Entries of the labels map are UTF8 strings that comply with the following restrictions: * Keys must conform to regexp: \p{Ll}\p{Lo}{0,62} * Values must conform to regexp: [\p{Ll}\p{Lo}\p{N}_-]{0,63} * Both keys and values are additionally constrained to be <= 128 bytes in size. |
satisfiesPzi | boolean | Output only. Reserved for future use. |
satisfiesPzs | boolean | Output only. Reserved for future use. |
state | string | The current state of the environment. |
storageConfig | object | Optional. Storage configuration for this environment. (id: StorageConfig) |
updateTime | string (google-datetime) | Output only. The time at which this environment was last modified. |
uuid | string | Output only. The UUID (Universally Unique IDentifier) associated with this environment. This value is generated when the environment is created. |
Methods
The following methods are available for this resource:
Name | Accessible by | Required Params | Optional Params | Description |
---|---|---|---|---|
get | select | projectsId , locationsId , environmentsId | Get an existing environment. | |
list | select | projectsId , locationsId | pageSize , pageToken | List environments. |
create | insert | projectsId , locationsId | Create a new environment. | |
patch | update | projectsId , locationsId , environmentsId | updateMask | Update an environment. |
delete | delete | projectsId , locationsId , environmentsId | Delete an environment. | |
restart_web_server | exec | projectsId , locationsId , environmentsId | Restart Airflow web server. | |
execute_airflow_command | exec | projectsId , locationsId , environmentsId | Executes Airflow CLI command. | |
stop_airflow_command | exec | projectsId , locationsId , environmentsId | Stops Airflow CLI command execution. | |
poll_airflow_command | exec | projectsId , locationsId , environmentsId | Polls Airflow CLI command execution and fetches logs. | |
check_upgrade | exec | projectsId , locationsId , environmentsId | Check if an upgrade operation on the environment will succeed. In case of problems detailed info can be found in the returned Operation. | |
save_snapshot | exec | projectsId , locationsId , environmentsId | Creates a snapshots of a Cloud Composer environment. As a result of this operation, snapshot of environment's state is stored in a location specified in the SaveSnapshotRequest. | |
load_snapshot | exec | projectsId , locationsId , environmentsId | Loads a snapshot of a Cloud Composer environment. As a result of this operation, a snapshot of environment's specified in LoadSnapshotRequest is loaded into the environment. | |
database_failover | exec | projectsId , locationsId , environmentsId | Triggers database failover (only for highly resilient environments). |
Parameters
Parameters can be passed in the WHERE
clause of a query. Check the Methods section to see which parameters are required or optional for each operation.
Name | Datatype | Description |
---|---|---|
environmentsId | string | |
locationsId | string | |
projectsId | string | |
pageSize | integer (int32) | |
pageToken | string | |
updateMask | string (google-fieldmask) |
SELECT
examples
- get
- list
Get an existing environment.
SELECT
name,
config,
createTime,
labels,
satisfiesPzi,
satisfiesPzs,
state,
storageConfig,
updateTime,
uuid
FROM google.composer.environments
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND environmentsId = '{{ environmentsId }}' -- required;
List environments.
SELECT
name,
config,
createTime,
labels,
satisfiesPzi,
satisfiesPzs,
state,
storageConfig,
updateTime,
uuid
FROM google.composer.environments
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND pageSize = '{{ pageSize }}'
AND pageToken = '{{ pageToken }}';
INSERT
examples
- create
- Manifest
Create a new environment.
INSERT INTO google.composer.environments (
data__name,
data__config,
data__uuid,
data__state,
data__createTime,
data__updateTime,
data__labels,
data__storageConfig,
projectsId,
locationsId
)
SELECT
'{{ name }}',
'{{ config }}',
'{{ uuid }}',
'{{ state }}',
'{{ createTime }}',
'{{ updateTime }}',
'{{ labels }}',
'{{ storageConfig }}',
'{{ projectsId }}',
'{{ locationsId }}'
RETURNING
name,
done,
error,
metadata,
response
;
# Description fields are for documentation purposes
- name: environments
props:
- name: projectsId
value: string
description: Required parameter for the environments resource.
- name: locationsId
value: string
description: Required parameter for the environments resource.
- name: name
value: string
description: >
Identifier. The resource name of the environment, in the form: "projects/{projectId}/locations/{locationId}/environments/{environmentId}" EnvironmentId must start with a lowercase letter followed by up to 63 lowercase letters, numbers, or hyphens, and cannot end with a hyphen.
- name: config
value: object
description: >
Optional. Configuration parameters for this environment.
- name: uuid
value: string
description: >
Output only. The UUID (Universally Unique IDentifier) associated with this environment. This value is generated when the environment is created.
- name: state
value: string
description: >
The current state of the environment.
valid_values: ['STATE_UNSPECIFIED', 'CREATING', 'RUNNING', 'UPDATING', 'DELETING', 'ERROR']
- name: createTime
value: string
description: >
Output only. The time at which this environment was created.
- name: updateTime
value: string
description: >
Output only. The time at which this environment was last modified.
- name: labels
value: object
description: >
Optional. User-defined labels for this environment. The labels map can contain no more than 64 entries. Entries of the labels map are UTF8 strings that comply with the following restrictions: * Keys must conform to regexp: \p{Ll}\p{Lo}{0,62} * Values must conform to regexp: [\p{Ll}\p{Lo}\p{N}_-]{0,63} * Both keys and values are additionally constrained to be <= 128 bytes in size.
- name: storageConfig
value: object
description: >
Optional. Storage configuration for this environment.
UPDATE
examples
- patch
Update an environment.
UPDATE google.composer.environments
SET
data__name = '{{ name }}',
data__config = '{{ config }}',
data__uuid = '{{ uuid }}',
data__state = '{{ state }}',
data__createTime = '{{ createTime }}',
data__updateTime = '{{ updateTime }}',
data__labels = '{{ labels }}',
data__storageConfig = '{{ storageConfig }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND environmentsId = '{{ environmentsId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
done,
error,
metadata,
response;
DELETE
examples
- delete
Delete an environment.
DELETE FROM google.composer.environments
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND environmentsId = '{{ environmentsId }}' --required;
Lifecycle Methods
- restart_web_server
- execute_airflow_command
- stop_airflow_command
- poll_airflow_command
- check_upgrade
- save_snapshot
- load_snapshot
- database_failover
Restart Airflow web server.
EXEC google.composer.environments.restart_web_server
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@environmentsId='{{ environmentsId }}' --required;
Executes Airflow CLI command.
EXEC google.composer.environments.execute_airflow_command
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@environmentsId='{{ environmentsId }}' --required
@@json=
'{
"command": "{{ command }}",
"subcommand": "{{ subcommand }}",
"parameters": "{{ parameters }}"
}';
Stops Airflow CLI command execution.
EXEC google.composer.environments.stop_airflow_command
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@environmentsId='{{ environmentsId }}' --required
@@json=
'{
"executionId": "{{ executionId }}",
"pod": "{{ pod }}",
"podNamespace": "{{ podNamespace }}",
"force": {{ force }}
}';
Polls Airflow CLI command execution and fetches logs.
EXEC google.composer.environments.poll_airflow_command
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@environmentsId='{{ environmentsId }}' --required
@@json=
'{
"executionId": "{{ executionId }}",
"pod": "{{ pod }}",
"podNamespace": "{{ podNamespace }}",
"nextLineNumber": {{ nextLineNumber }}
}';
Check if an upgrade operation on the environment will succeed. In case of problems detailed info can be found in the returned Operation.
EXEC google.composer.environments.check_upgrade
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@environmentsId='{{ environmentsId }}' --required
@@json=
'{
"imageVersion": "{{ imageVersion }}"
}';
Creates a snapshots of a Cloud Composer environment. As a result of this operation, snapshot of environment's state is stored in a location specified in the SaveSnapshotRequest.
EXEC google.composer.environments.save_snapshot
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@environmentsId='{{ environmentsId }}' --required
@@json=
'{
"snapshotLocation": "{{ snapshotLocation }}"
}';
Loads a snapshot of a Cloud Composer environment. As a result of this operation, a snapshot of environment's specified in LoadSnapshotRequest is loaded into the environment.
EXEC google.composer.environments.load_snapshot
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@environmentsId='{{ environmentsId }}' --required
@@json=
'{
"snapshotPath": "{{ snapshotPath }}",
"skipPypiPackagesInstallation": {{ skipPypiPackagesInstallation }},
"skipEnvironmentVariablesSetting": {{ skipEnvironmentVariablesSetting }},
"skipAirflowOverridesSetting": {{ skipAirflowOverridesSetting }},
"skipGcsDataCopying": {{ skipGcsDataCopying }}
}';
Triggers database failover (only for highly resilient environments).
EXEC google.composer.environments.database_failover
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@environmentsId='{{ environmentsId }}' --required;