Google Cloud Composer (Orchestration Airflow) API client library for managing Apache Airflow environments
npx @tessl/cli install tessl/pypi-google-cloud-orchestration-airflow@1.17.00
# Google Cloud Orchestration Airflow
1
2
Google Cloud Orchestration Airflow is a Python client library for Google Cloud Composer, enabling programmatic management of Apache Airflow environments in Google Cloud Platform. It provides comprehensive API coverage for creating, scheduling, monitoring, and managing workflows through Cloud Composer's managed Apache Airflow service.
3
4
## Package Information
5
6
- **Package Name**: google-cloud-orchestration-airflow
7
- **Language**: Python
8
- **Installation**: `pip install google-cloud-orchestration-airflow`
9
- **Python Support**: 3.7+
10
11
## Core Imports
12
13
```python
14
from google.cloud.orchestration.airflow.service import (
15
EnvironmentsClient,
16
EnvironmentsAsyncClient,
17
ImageVersionsClient,
18
ImageVersionsAsyncClient
19
)
20
```
21
22
For specific types:
23
24
```python
25
from google.cloud.orchestration.airflow.service import (
26
Environment,
27
EnvironmentConfig,
28
CreateEnvironmentRequest,
29
ListEnvironmentsRequest,
30
ImageVersion
31
)
32
```
33
34
## Basic Usage
35
36
```python
37
from google.cloud.orchestration.airflow.service import EnvironmentsClient
38
39
# Initialize the client
40
client = EnvironmentsClient()
41
42
# List environments in a project and location
43
project_id = "your-project-id"
44
location = "us-central1"
45
parent = f"projects/{project_id}/locations/{location}"
46
47
request = {"parent": parent}
48
page_result = client.list_environments(request=request)
49
50
for environment in page_result:
51
print(f"Environment: {environment.name}")
52
print(f"State: {environment.state}")
53
```
54
55
## Architecture
56
57
The library follows Google Cloud client library patterns with:
58
59
- **Synchronous Clients**: `EnvironmentsClient`, `ImageVersionsClient` for blocking operations
60
- **Asynchronous Clients**: `EnvironmentsAsyncClient`, `ImageVersionsAsyncClient` for async/await patterns
61
- **Transport Layer**: Supports gRPC, gRPC AsyncIO, and REST transports
62
- **Request/Response Types**: Strongly typed request and response objects
63
- **Authentication**: Integration with Google Cloud authentication and authorization systems
64
- **Error Handling**: Built-in retry logic and comprehensive exception handling
65
66
## Capabilities
67
68
### Environment Management
69
70
Complete lifecycle management of Cloud Composer environments including creation, configuration, monitoring, updates, and deletion. Supports advanced features like snapshots, upgrades, database operations, and Airflow command execution.
71
72
```python { .api }
73
class EnvironmentsClient:
74
def create_environment(
75
self,
76
request: CreateEnvironmentRequest,
77
**kwargs
78
) -> Operation: ...
79
80
def get_environment(
81
self,
82
request: GetEnvironmentRequest,
83
**kwargs
84
) -> Environment: ...
85
86
def list_environments(
87
self,
88
request: ListEnvironmentsRequest,
89
**kwargs
90
) -> pagers.ListEnvironmentsPager: ...
91
92
def update_environment(
93
self,
94
request: UpdateEnvironmentRequest,
95
**kwargs
96
) -> Operation: ...
97
98
def delete_environment(
99
self,
100
request: DeleteEnvironmentRequest,
101
**kwargs
102
) -> Operation: ...
103
```
104
105
[Environment Management](./environment-management.md)
106
107
### Image Versions
108
109
Query available Apache Airflow image versions supported by Cloud Composer, including version metadata and compatibility information.
110
111
```python { .api }
112
class ImageVersionsClient:
113
def list_image_versions(
114
self,
115
request: ListImageVersionsRequest,
116
**kwargs
117
) -> pagers.ListImageVersionsPager: ...
118
```
119
120
[Image Versions](./image-versions.md)
121
122
### User Workloads Management
123
124
Manage user workloads secrets and configuration maps within Cloud Composer environments for secure handling of sensitive data and configuration.
125
126
```python { .api }
127
class EnvironmentsClient:
128
def create_user_workloads_secret(
129
self,
130
request: CreateUserWorkloadsSecretRequest,
131
**kwargs
132
) -> UserWorkloadsSecret: ...
133
134
def create_user_workloads_config_map(
135
self,
136
request: CreateUserWorkloadsConfigMapRequest,
137
**kwargs
138
) -> UserWorkloadsConfigMap: ...
139
```
140
141
[User Workloads Management](./user-workloads.md)
142
143
## Core Types
144
145
### Environment Types
146
147
```python { .api }
148
class Environment:
149
"""
150
An environment for running orchestrated workflows.
151
152
Attributes:
153
name (str): Environment resource name
154
config (EnvironmentConfig): Configuration parameters
155
uuid (str): Output-only UUID assigned to the environment
156
state (State): Output-only state of the environment
157
create_time (google.protobuf.timestamp_pb2.Timestamp): Creation timestamp
158
update_time (google.protobuf.timestamp_pb2.Timestamp): Last update timestamp
159
labels (Mapping[str, str]): Environment labels
160
satisfies_pzs (bool): Output-only flag for private zone separation
161
storage_config (StorageConfig): Cloud Storage configuration
162
"""
163
164
class EnvironmentConfig:
165
"""
166
Configuration information for an environment.
167
168
Attributes:
169
gke_cluster (str): Output-only GKE cluster name
170
dag_gcs_prefix (str): Output-only DAGs folder Cloud Storage prefix
171
node_count (int): Number of nodes in the environment
172
software_config (SoftwareConfig): Software configuration
173
node_config (NodeConfig): Node configuration
174
private_environment_config (PrivateEnvironmentConfig): Private environment configuration
175
web_server_config (WebServerConfig): Web server configuration
176
database_config (DatabaseConfig): Database configuration
177
web_server_network_access_control (WebServerNetworkAccessControl): Network access control
178
storage_config (StorageConfig): Cloud Storage configuration
179
encryption_config (EncryptionConfig): Encryption configuration
180
maintenance_window (MaintenanceWindow): Maintenance window configuration
181
workloads_config (WorkloadsConfig): Workloads configuration
182
environment_size (EnvironmentSize): Environment size preset
183
airflow_uri (str): Output-only Airflow web server URI
184
airflow_byoid_uri (str): Output-only Airflow web server BYOID URI
185
master_authorized_networks_config (MasterAuthorizedNetworksConfig): Master authorized networks
186
recovery_config (RecoveryConfig): Recovery configuration
187
resilience_mode (ResilienceMode): Resilience mode setting
188
data_retention_config (DataRetentionConfig): Data retention configuration
189
"""
190
```
191
192
### Request Types
193
194
```python { .api }
195
class CreateEnvironmentRequest:
196
"""
197
Request to create a new environment.
198
199
Attributes:
200
parent (str): Required. Location where to create environment (projects/{project}/locations/{location})
201
environment (Environment): Required. Environment to create
202
"""
203
204
class ListEnvironmentsRequest:
205
"""
206
Request to list environments.
207
208
Attributes:
209
parent (str): Required. List environments in location (projects/{project}/locations/{location})
210
page_size (int): Optional. Maximum number of environments to return
211
page_token (str): Optional. Token for pagination
212
"""
213
214
class GetEnvironmentRequest:
215
"""
216
Request to get environment details.
217
218
Attributes:
219
name (str): Required. Environment resource name
220
"""
221
```
222
223
### Operation Types
224
225
```python { .api }
226
class OperationMetadata:
227
"""
228
Metadata for long-running operations.
229
230
Attributes:
231
state (State): Current operation state
232
operation_type (Type): Type of operation
233
resource (str): Resource being operated on
234
resource_uuid (str): Resource UUID
235
create_time (google.protobuf.timestamp_pb2.Timestamp): Operation creation time
236
end_time (google.protobuf.timestamp_pb2.Timestamp): Operation completion time
237
"""
238
```
239
240
### Enums
241
242
```python { .api }
243
class EnvironmentSize(enum.Enum):
244
"""
245
Environment size preset options.
246
247
Values:
248
ENVIRONMENT_SIZE_UNSPECIFIED (0): Size unspecified
249
ENVIRONMENT_SIZE_SMALL (1): Small environment
250
ENVIRONMENT_SIZE_MEDIUM (2): Medium environment
251
ENVIRONMENT_SIZE_LARGE (3): Large environment
252
"""
253
254
class ResilienceMode(enum.Enum):
255
"""
256
Environment resilience mode options.
257
258
Values:
259
RESILIENCE_MODE_UNSPECIFIED (0): Resilience mode unspecified
260
HIGH_RESILIENCE (1): High resilience mode
261
"""
262
263
class State(enum.Enum):
264
"""
265
Environment state values.
266
267
Values:
268
STATE_UNSPECIFIED (0): State unspecified
269
CREATING (1): Environment is being created
270
RUNNING (2): Environment is running
271
UPDATING (3): Environment is being updated
272
DELETING (4): Environment is being deleted
273
ERROR (5): Environment is in error state
274
"""
275
```