or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

environment-management.mdimage-versions.mdindex.mduser-workloads.md

user-workloads.mddocs/

0

# User Workloads Management

1

2

Manage user workloads secrets and configuration maps within Cloud Composer environments for secure handling of sensitive data, configuration parameters, and runtime settings.

3

4

## Capabilities

5

6

### User Workloads Secrets

7

8

Create, read, update, and delete secrets for user workloads within Cloud Composer environments.

9

10

```python { .api }

11

def create_user_workloads_secret(

12

self,

13

request: CreateUserWorkloadsSecretRequest,

14

retry: OptionalRetry = gapic_v1.method.DEFAULT,

15

timeout: float = None,

16

metadata: Sequence[Tuple[str, str]] = ()

17

) -> UserWorkloadsSecret:

18

"""

19

Create a user workloads secret.

20

21

Parameters:

22

request (CreateUserWorkloadsSecretRequest): Required. Request object containing environment parent and secret configuration.

23

retry (OptionalRetry): Retry configuration for the request.

24

timeout (float): Request timeout in seconds.

25

metadata (Sequence[Tuple[str, str]]): Additional gRPC metadata.

26

27

Returns:

28

UserWorkloadsSecret: Created secret with metadata and data.

29

30

Raises:

31

google.api_core.exceptions.GoogleAPICallError: If the request fails.

32

"""

33

34

def get_user_workloads_secret(

35

self,

36

request: GetUserWorkloadsSecretRequest,

37

retry: OptionalRetry = gapic_v1.method.DEFAULT,

38

timeout: float = None,

39

metadata: Sequence[Tuple[str, str]] = ()

40

) -> UserWorkloadsSecret:

41

"""

42

Get a user workloads secret.

43

44

Parameters:

45

request (GetUserWorkloadsSecretRequest): Required. Request object containing secret name.

46

retry (OptionalRetry): Retry configuration for the request.

47

timeout (float): Request timeout in seconds.

48

metadata (Sequence[Tuple[str, str]]): Additional gRPC metadata.

49

50

Returns:

51

UserWorkloadsSecret: Secret details including data.

52

53

Raises:

54

google.api_core.exceptions.GoogleAPICallError: If the request fails.

55

"""

56

57

def list_user_workloads_secrets(

58

self,

59

request: ListUserWorkloadsSecretsRequest,

60

retry: OptionalRetry = gapic_v1.method.DEFAULT,

61

timeout: float = None,

62

metadata: Sequence[Tuple[str, str]] = ()

63

) -> pagers.ListUserWorkloadsSecretsPager:

64

"""

65

List user workloads secrets in an environment.

66

67

Parameters:

68

request (ListUserWorkloadsSecretsRequest): Required. Request object containing environment parent and pagination options.

69

retry (OptionalRetry): Retry configuration for the request.

70

timeout (float): Request timeout in seconds.

71

metadata (Sequence[Tuple[str, str]]): Additional gRPC metadata.

72

73

Returns:

74

pagers.ListUserWorkloadsSecretsPager: Paginated list of secrets.

75

76

Raises:

77

google.api_core.exceptions.GoogleAPICallError: If the request fails.

78

"""

79

80

def update_user_workloads_secret(

81

self,

82

request: UpdateUserWorkloadsSecretRequest,

83

retry: OptionalRetry = gapic_v1.method.DEFAULT,

84

timeout: float = None,

85

metadata: Sequence[Tuple[str, str]] = ()

86

) -> UserWorkloadsSecret:

87

"""

88

Update a user workloads secret.

89

90

Parameters:

91

request (UpdateUserWorkloadsSecretRequest): Required. Request object containing secret and field mask.

92

retry (OptionalRetry): Retry configuration for the request.

93

timeout (float): Request timeout in seconds.

94

metadata (Sequence[Tuple[str, str]]): Additional gRPC metadata.

95

96

Returns:

97

UserWorkloadsSecret: Updated secret with new data.

98

99

Raises:

100

google.api_core.exceptions.GoogleAPICallError: If the request fails.

101

"""

102

103

def delete_user_workloads_secret(

104

self,

105

request: DeleteUserWorkloadsSecretRequest,

106

retry: OptionalRetry = gapic_v1.method.DEFAULT,

107

timeout: float = None,

108

metadata: Sequence[Tuple[str, str]] = ()

109

) -> None:

110

"""

111

Delete a user workloads secret.

112

113

Parameters:

114

request (DeleteUserWorkloadsSecretRequest): Required. Request object containing secret name.

115

retry (OptionalRetry): Retry configuration for the request.

116

timeout (float): Request timeout in seconds.

117

metadata (Sequence[Tuple[str, str]]): Additional gRPC metadata.

118

119

Returns:

120

None

121

122

Raises:

123

google.api_core.exceptions.GoogleAPICallError: If the request fails.

124

"""

125

```

126

127

### User Workloads Config Maps

128

129

Create, read, update, and delete configuration maps for user workloads within Cloud Composer environments.

130

131

```python { .api }

132

def create_user_workloads_config_map(

133

self,

134

request: CreateUserWorkloadsConfigMapRequest,

135

retry: OptionalRetry = gapic_v1.method.DEFAULT,

136

timeout: float = None,

137

metadata: Sequence[Tuple[str, str]] = ()

138

) -> UserWorkloadsConfigMap:

139

"""

140

Create a user workloads config map.

141

142

Parameters:

143

request (CreateUserWorkloadsConfigMapRequest): Required. Request object containing environment parent and config map configuration.

144

retry (OptionalRetry): Retry configuration for the request.

145

timeout (float): Request timeout in seconds.

146

metadata (Sequence[Tuple[str, str]]): Additional gRPC metadata.

147

148

Returns:

149

UserWorkloadsConfigMap: Created config map with metadata and data.

150

151

Raises:

152

google.api_core.exceptions.GoogleAPICallError: If the request fails.

153

"""

154

155

def get_user_workloads_config_map(

156

self,

157

request: GetUserWorkloadsConfigMapRequest,

158

retry: OptionalRetry = gapic_v1.method.DEFAULT,

159

timeout: float = None,

160

metadata: Sequence[Tuple[str, str]] = ()

161

) -> UserWorkloadsConfigMap:

162

"""

163

Get a user workloads config map.

164

165

Parameters:

166

request (GetUserWorkloadsConfigMapRequest): Required. Request object containing config map name.

167

retry (OptionalRetry): Retry configuration for the request.

168

timeout (float): Request timeout in seconds.

169

metadata (Sequence[Tuple[str, str]]): Additional gRPC metadata.

170

171

Returns:

172

UserWorkloadsConfigMap: Config map details including data.

173

174

Raises:

175

google.api_core.exceptions.GoogleAPICallError: If the request fails.

176

"""

177

178

def list_user_workloads_config_maps(

179

self,

180

request: ListUserWorkloadsConfigMapsRequest,

181

retry: OptionalRetry = gapic_v1.method.DEFAULT,

182

timeout: float = None,

183

metadata: Sequence[Tuple[str, str]] = ()

184

) -> pagers.ListUserWorkloadsConfigMapsPager:

185

"""

186

List user workloads config maps in an environment.

187

188

Parameters:

189

request (ListUserWorkloadsConfigMapsRequest): Required. Request object containing environment parent and pagination options.

190

retry (OptionalRetry): Retry configuration for the request.

191

timeout (float): Request timeout in seconds.

192

metadata (Sequence[Tuple[str, str]]): Additional gRPC metadata.

193

194

Returns:

195

pagers.ListUserWorkloadsConfigMapsPager: Paginated list of config maps.

196

197

Raises:

198

google.api_core.exceptions.GoogleAPICallError: If the request fails.

199

"""

200

201

def update_user_workloads_config_map(

202

self,

203

request: UpdateUserWorkloadsConfigMapRequest,

204

retry: OptionalRetry = gapic_v1.method.DEFAULT,

205

timeout: float = None,

206

metadata: Sequence[Tuple[str, str]] = ()

207

) -> UserWorkloadsConfigMap:

208

"""

209

Update a user workloads config map.

210

211

Parameters:

212

request (UpdateUserWorkloadsConfigMapRequest): Required. Request object containing config map and field mask.

213

retry (OptionalRetry): Retry configuration for the request.

214

timeout (float): Request timeout in seconds.

215

metadata (Sequence[Tuple[str, str]]): Additional gRPC metadata.

216

217

Returns:

218

UserWorkloadsConfigMap: Updated config map with new data.

219

220

Raises:

221

google.api_core.exceptions.GoogleAPICallError: If the request fails.

222

"""

223

224

def delete_user_workloads_config_map(

225

self,

226

request: DeleteUserWorkloadsConfigMapRequest,

227

retry: OptionalRetry = gapic_v1.method.DEFAULT,

228

timeout: float = None,

229

metadata: Sequence[Tuple[str, str]] = ()

230

) -> None:

231

"""

232

Delete a user workloads config map.

233

234

Parameters:

235

request (DeleteUserWorkloadsConfigMapRequest): Required. Request object containing config map name.

236

retry (OptionalRetry): Retry configuration for the request.

237

timeout (float): Request timeout in seconds.

238

metadata (Sequence[Tuple[str, str]]): Additional gRPC metadata.

239

240

Returns:

241

None

242

243

Raises:

244

google.api_core.exceptions.GoogleAPICallError: If the request fails.

245

"""

246

```

247

248

### Usage Examples

249

250

```python

251

from google.cloud.orchestration.airflow.service import EnvironmentsClient

252

253

# Initialize client

254

client = EnvironmentsClient()

255

256

# Create a secret for database credentials

257

project_id = "your-project-id"

258

location = "us-central1"

259

environment_id = "my-environment"

260

parent = f"projects/{project_id}/locations/{location}/environments/{environment_id}"

261

262

# Create secret

263

secret_request = {

264

"parent": parent,

265

"user_workloads_secret": {

266

"name": f"{parent}/userWorkloadsSecrets/db-credentials",

267

"data": {

268

"username": b"db_user",

269

"password": b"secure_password"

270

}

271

}

272

}

273

274

secret = client.create_user_workloads_secret(request=secret_request)

275

print(f"Created secret: {secret.name}")

276

277

# Create config map for application settings

278

config_map_request = {

279

"parent": parent,

280

"user_workloads_config_map": {

281

"name": f"{parent}/userWorkloadsConfigMaps/app-config",

282

"data": {

283

"debug_mode": "false",

284

"log_level": "INFO",

285

"max_workers": "10"

286

}

287

}

288

}

289

290

config_map = client.create_user_workloads_config_map(request=config_map_request)

291

print(f"Created config map: {config_map.name}")

292

293

# List all secrets

294

list_secrets_request = {"parent": parent}

295

secrets_page = client.list_user_workloads_secrets(request=list_secrets_request)

296

297

for secret in secrets_page:

298

print(f"Secret: {secret.name}")

299

print(f"Keys: {list(secret.data.keys())}")

300

```

301

302

## Request/Response Types

303

304

### Secret Request Types

305

306

```python { .api }

307

class CreateUserWorkloadsSecretRequest:

308

"""

309

Request to create a user workloads secret.

310

311

Attributes:

312

parent (str): Required. Environment resource name (projects/{project}/locations/{location}/environments/{environment})

313

user_workloads_secret (UserWorkloadsSecret): Required. Secret to create

314

"""

315

316

class GetUserWorkloadsSecretRequest:

317

"""

318

Request to get a user workloads secret.

319

320

Attributes:

321

name (str): Required. Secret resource name

322

"""

323

324

class ListUserWorkloadsSecretsRequest:

325

"""

326

Request to list user workloads secrets.

327

328

Attributes:

329

parent (str): Required. Environment resource name

330

page_size (int): Optional. Maximum number of secrets to return per page

331

page_token (str): Optional. Token for pagination

332

"""

333

334

class UpdateUserWorkloadsSecretRequest:

335

"""

336

Request to update a user workloads secret.

337

338

Attributes:

339

user_workloads_secret (UserWorkloadsSecret): Required. Secret with updated data

340

"""

341

342

class DeleteUserWorkloadsSecretRequest:

343

"""

344

Request to delete a user workloads secret.

345

346

Attributes:

347

name (str): Required. Secret resource name to delete

348

"""

349

```

350

351

### Config Map Request Types

352

353

```python { .api }

354

class CreateUserWorkloadsConfigMapRequest:

355

"""

356

Request to create a user workloads config map.

357

358

Attributes:

359

parent (str): Required. Environment resource name (projects/{project}/locations/{location}/environments/{environment})

360

user_workloads_config_map (UserWorkloadsConfigMap): Required. Config map to create

361

"""

362

363

class GetUserWorkloadsConfigMapRequest:

364

"""

365

Request to get a user workloads config map.

366

367

Attributes:

368

name (str): Required. Config map resource name

369

"""

370

371

class ListUserWorkloadsConfigMapsRequest:

372

"""

373

Request to list user workloads config maps.

374

375

Attributes:

376

parent (str): Required. Environment resource name

377

page_size (int): Optional. Maximum number of config maps to return per page

378

page_token (str): Optional. Token for pagination

379

"""

380

381

class UpdateUserWorkloadsConfigMapRequest:

382

"""

383

Request to update a user workloads config map.

384

385

Attributes:

386

user_workloads_config_map (UserWorkloadsConfigMap): Required. Config map with updated data

387

"""

388

389

class DeleteUserWorkloadsConfigMapRequest:

390

"""

391

Request to delete a user workloads config map.

392

393

Attributes:

394

name (str): Required. Config map resource name to delete

395

"""

396

```

397

398

### Response Types

399

400

```python { .api }

401

class ListUserWorkloadsSecretsResponse:

402

"""

403

Response containing user workloads secrets.

404

405

Attributes:

406

user_workloads_secrets (MutableSequence[UserWorkloadsSecret]): List of secrets

407

next_page_token (str): Token for retrieving next page of results

408

"""

409

410

class ListUserWorkloadsConfigMapsResponse:

411

"""

412

Response containing user workloads config maps.

413

414

Attributes:

415

user_workloads_config_maps (MutableSequence[UserWorkloadsConfigMap]): List of config maps

416

next_page_token (str): Token for retrieving next page of results

417

"""

418

```

419

420

### Data Types

421

422

```python { .api }

423

class UserWorkloadsSecret:

424

"""

425

User workloads secret stored in an environment.

426

427

Attributes:

428

name (str): Secret resource name

429

data (MutableMapping[str, bytes]): Secret data as key-value pairs with binary values

430

"""

431

432

class UserWorkloadsConfigMap:

433

"""

434

User workloads config map stored in an environment.

435

436

Attributes:

437

name (str): Config map resource name

438

data (MutableMapping[str, str]): Config data as key-value pairs with string values

439

"""

440

```