or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

asset-dvr-management.mdchannel-management.mdclip-management.mdevent-management.mdindex.mdinput-management.mdpool-management.md

pool-management.mddocs/

0

# Resource Pool Management

1

2

Management of resource pools that organize and control access to streaming resources across projects and regions.

3

4

## Capabilities

5

6

### Getting Pool Details

7

8

Retrieves detailed information about a specific resource pool including its network configuration and resource allocations.

9

10

```python { .api }

11

def get_pool(

12

self,

13

request: Union[GetPoolRequest, dict] = None,

14

*,

15

name: str = None,

16

retry: OptionalRetry = gapic_v1.method.DEFAULT,

17

timeout: Union[float, object] = gapic_v1.method.DEFAULT,

18

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

19

) -> Pool:

20

"""

21

Returns the specified pool.

22

23

Args:

24

request: The request object containing name

25

name: Required. The pool name (projects/{project}/locations/{location}/pools/{pool})

26

retry: Retry configuration for the request

27

timeout: Request timeout in seconds

28

metadata: Additional metadata for the request

29

30

Returns:

31

Pool: The pool resource

32

33

Raises:

34

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

35

"""

36

```

37

38

### Updating Pool Configuration

39

40

Updates resource pool configuration including network settings and resource allocation parameters.

41

42

```python { .api }

43

def update_pool(

44

self,

45

request: Union[UpdatePoolRequest, dict] = None,

46

*,

47

pool: Pool = None,

48

update_mask: field_mask_pb2.FieldMask = None,

49

retry: OptionalRetry = gapic_v1.method.DEFAULT,

50

timeout: Union[float, object] = gapic_v1.method.DEFAULT,

51

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

52

) -> operation.Operation:

53

"""

54

Updates the specified pool.

55

56

Args:

57

request: The request object containing update_mask, pool, and request_id

58

pool: Required. The pool resource with updated fields

59

update_mask: Required. Field mask specifying which fields to update

60

retry: Retry configuration for the request

61

timeout: Request timeout in seconds

62

metadata: Additional metadata for the request

63

64

Returns:

65

google.api_core.operation.Operation: Long-running operation

66

67

Raises:

68

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

69

"""

70

```

71

72

## Pool Configuration Types

73

74

### Pool Resource

75

76

```python { .api }

77

class Pool:

78

"""

79

Pool resource for organizing and managing streaming resources.

80

81

Attributes:

82

name (str): Pool resource name

83

create_time (google.protobuf.timestamp_pb2.Timestamp): Creation timestamp

84

update_time (google.protobuf.timestamp_pb2.Timestamp): Last update timestamp

85

labels (MutableMapping[str, str]): User-defined labels

86

network_config (NetworkConfig): Network configuration for the pool

87

"""

88

```

89

90

### Network Configuration

91

92

```python { .api }

93

class NetworkConfig:

94

"""

95

Network configuration for resource pools.

96

97

Attributes:

98

peered_network (str): Peered VPC network for private connectivity

99

"""

100

```

101

102

### Request Types

103

104

```python { .api }

105

class GetPoolRequest:

106

"""

107

Request message for GetPool.

108

109

Attributes:

110

name (str): Required. The pool resource name

111

"""

112

113

class UpdatePoolRequest:

114

"""

115

Request message for UpdatePool.

116

117

Attributes:

118

update_mask (google.protobuf.field_mask_pb2.FieldMask): Required. Field mask for update

119

pool (Pool): Required. The pool resource with updated fields

120

request_id (str): Optional. Idempotency key for request deduplication

121

"""

122

```

123

124

## Usage Examples

125

126

### Getting Pool Information

127

128

```python

129

from google.cloud.video import live_stream_v1

130

131

client = live_stream_v1.LivestreamServiceClient()

132

133

# Get pool details

134

pool_name = "projects/my-project/locations/us-central1/pools/my-pool"

135

136

get_request = live_stream_v1.GetPoolRequest(name=pool_name)

137

pool = client.get_pool(request=get_request)

138

139

print(f"Pool: {pool.name}")

140

print(f"Created: {pool.create_time}")

141

print(f"Updated: {pool.update_time}")

142

print(f"Labels: {dict(pool.labels)}")

143

144

if pool.network_config.peered_network:

145

print(f"Peered network: {pool.network_config.peered_network}")

146

```

147

148

### Updating Pool Network Configuration

149

150

```python

151

from google.protobuf import field_mask_pb2

152

153

# Update pool network configuration

154

pool_name = "projects/my-project/locations/us-central1/pools/my-pool"

155

156

updated_pool = live_stream_v1.Pool(

157

name=pool_name,

158

network_config=live_stream_v1.NetworkConfig(

159

peered_network="projects/my-project/global/networks/livestream-vpc"

160

)

161

)

162

163

update_mask = field_mask_pb2.FieldMask(

164

paths=["network_config.peered_network"]

165

)

166

167

update_request = live_stream_v1.UpdatePoolRequest(

168

pool=updated_pool,

169

update_mask=update_mask

170

)

171

172

operation = client.update_pool(request=update_request)

173

updated_pool_result = operation.result()

174

print(f"Updated pool network configuration: {updated_pool_result.network_config.peered_network}")

175

```

176

177

### Updating Pool Labels

178

179

```python

180

# Update pool labels for organization and management

181

pool_name = "projects/my-project/locations/us-central1/pools/production-pool"

182

183

updated_pool = live_stream_v1.Pool(

184

name=pool_name,

185

labels={

186

"environment": "production",

187

"team": "media-engineering",

188

"cost-center": "broadcasting",

189

"region": "us-central1"

190

}

191

)

192

193

update_mask = field_mask_pb2.FieldMask(

194

paths=["labels"]

195

)

196

197

update_request = live_stream_v1.UpdatePoolRequest(

198

pool=updated_pool,

199

update_mask=update_mask

200

)

201

202

operation = client.update_pool(request=update_request)

203

result = operation.result()

204

print(f"Updated pool labels: {dict(result.labels)}")

205

```

206

207

### Pool Configuration Management

208

209

```python

210

# Comprehensive pool configuration update

211

def configure_pool(client, pool_name, vpc_network, labels=None):

212

"""Configure a resource pool with network and labeling."""

213

214

if labels is None:

215

labels = {}

216

217

# Build the pool configuration

218

pool_config = live_stream_v1.Pool(

219

name=pool_name,

220

network_config=live_stream_v1.NetworkConfig(

221

peered_network=vpc_network

222

),

223

labels=labels

224

)

225

226

# Define what fields to update

227

update_paths = ["network_config.peered_network"]

228

if labels:

229

update_paths.append("labels")

230

231

update_mask = field_mask_pb2.FieldMask(paths=update_paths)

232

233

# Execute the update

234

request = live_stream_v1.UpdatePoolRequest(

235

pool=pool_config,

236

update_mask=update_mask

237

)

238

239

operation = client.update_pool(request=request)

240

return operation.result()

241

242

# Example usage

243

pool_name = "projects/my-project/locations/us-central1/pools/media-pool"

244

vpc_network = "projects/my-project/global/networks/media-vpc"

245

labels = {

246

"environment": "production",

247

"application": "live-streaming",

248

"managed-by": "terraform"

249

}

250

251

updated_pool = configure_pool(client, pool_name, vpc_network, labels)

252

print(f"Pool configured successfully: {updated_pool.name}")

253

```

254

255

### Pool Status and Monitoring

256

257

```python

258

def monitor_pool_status(client, pool_name):

259

"""Monitor pool status and configuration."""

260

261

try:

262

get_request = live_stream_v1.GetPoolRequest(name=pool_name)

263

pool = client.get_pool(request=get_request)

264

265

# Display pool information

266

print(f"Pool Status Report")

267

print(f"==================")

268

print(f"Name: {pool.name}")

269

print(f"Created: {pool.create_time}")

270

print(f"Last Updated: {pool.update_time}")

271

272

# Network configuration

273

if pool.network_config.peered_network:

274

print(f"Peered Network: {pool.network_config.peered_network}")

275

else:

276

print("Peered Network: Not configured")

277

278

# Labels

279

if pool.labels:

280

print("Labels:")

281

for key, value in pool.labels.items():

282

print(f" {key}: {value}")

283

else:

284

print("Labels: None")

285

286

return pool

287

288

except Exception as e:

289

print(f"Error retrieving pool status: {e}")

290

return None

291

292

# Monitor pool

293

pool_status = monitor_pool_status(

294

client,

295

"projects/my-project/locations/us-central1/pools/my-pool"

296

)

297

```

298

299

### Pool Network Connectivity Validation

300

301

```python

302

def validate_pool_network(client, pool_name, expected_network):

303

"""Validate pool network configuration matches expectations."""

304

305

get_request = live_stream_v1.GetPoolRequest(name=pool_name)

306

pool = client.get_pool(request=get_request)

307

308

current_network = pool.network_config.peered_network

309

310

if current_network == expected_network:

311

print(f"✓ Pool network configuration is correct: {current_network}")

312

return True

313

else:

314

print(f"✗ Pool network mismatch!")

315

print(f" Expected: {expected_network}")

316

print(f" Current: {current_network}")

317

return False

318

319

# Validate configuration

320

is_valid = validate_pool_network(

321

client,

322

"projects/my-project/locations/us-central1/pools/production-pool",

323

"projects/my-project/global/networks/production-vpc"

324

)

325

```