| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package gkemulticloud |
| 18 |
|
| 19 |
import ( |
| 20 |
"context" |
| 21 |
"fmt" |
| 22 |
"log/slog" |
| 23 |
"math" |
| 24 |
"net/url" |
| 25 |
"time" |
| 26 |
|
| 27 |
gkemulticloudpb "cloud.google.com/go/gkemulticloud/apiv1/gkemulticloudpb" |
| 28 |
"cloud.google.com/go/longrunning" |
| 29 |
lroauto "cloud.google.com/go/longrunning/autogen" |
| 30 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 31 |
gax "github.com/googleapis/gax-go/v2" |
| 32 |
"google.golang.org/api/iterator" |
| 33 |
"google.golang.org/api/option" |
| 34 |
"google.golang.org/api/option/internaloption" |
| 35 |
gtransport "google.golang.org/api/transport/grpc" |
| 36 |
"google.golang.org/grpc" |
| 37 |
"google.golang.org/grpc/codes" |
| 38 |
"google.golang.org/protobuf/proto" |
| 39 |
) |
| 40 |
|
| 41 |
var newAwsClustersClientHook clientHook |
| 42 |
|
| 43 |
|
| 44 |
type AwsClustersCallOptions struct { |
| 45 |
CreateAwsCluster []gax.CallOption |
| 46 |
UpdateAwsCluster []gax.CallOption |
| 47 |
GetAwsCluster []gax.CallOption |
| 48 |
ListAwsClusters []gax.CallOption |
| 49 |
DeleteAwsCluster []gax.CallOption |
| 50 |
GenerateAwsClusterAgentToken []gax.CallOption |
| 51 |
GenerateAwsAccessToken []gax.CallOption |
| 52 |
CreateAwsNodePool []gax.CallOption |
| 53 |
UpdateAwsNodePool []gax.CallOption |
| 54 |
RollbackAwsNodePoolUpdate []gax.CallOption |
| 55 |
GetAwsNodePool []gax.CallOption |
| 56 |
ListAwsNodePools []gax.CallOption |
| 57 |
DeleteAwsNodePool []gax.CallOption |
| 58 |
GetAwsOpenIdConfig []gax.CallOption |
| 59 |
GetAwsJsonWebKeys []gax.CallOption |
| 60 |
GetAwsServerConfig []gax.CallOption |
| 61 |
CancelOperation []gax.CallOption |
| 62 |
DeleteOperation []gax.CallOption |
| 63 |
GetOperation []gax.CallOption |
| 64 |
ListOperations []gax.CallOption |
| 65 |
} |
| 66 |
|
| 67 |
func defaultAwsClustersGRPCClientOptions() []option.ClientOption { |
| 68 |
return []option.ClientOption{ |
| 69 |
internaloption.WithDefaultEndpoint("gkemulticloud.googleapis.com:443"), |
| 70 |
internaloption.WithDefaultEndpointTemplate("gkemulticloud.UNIVERSE_DOMAIN:443"), |
| 71 |
internaloption.WithDefaultMTLSEndpoint("gkemulticloud.mtls.googleapis.com:443"), |
| 72 |
internaloption.WithDefaultUniverseDomain("googleapis.com"), |
| 73 |
internaloption.WithDefaultAudience("https://gkemulticloud.googleapis.com/"), |
| 74 |
internaloption.WithDefaultScopes(DefaultAuthScopes()...), |
| 75 |
internaloption.EnableJwtWithScope(), |
| 76 |
internaloption.EnableNewAuthLibrary(), |
| 77 |
option.WithGRPCDialOption(grpc.WithDefaultCallOptions( |
| 78 |
grpc.MaxCallRecvMsgSize(math.MaxInt32))), |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
func defaultAwsClustersCallOptions() *AwsClustersCallOptions { |
| 83 |
return &AwsClustersCallOptions{ |
| 84 |
CreateAwsCluster: []gax.CallOption{ |
| 85 |
gax.WithTimeout(60000 * time.Millisecond), |
| 86 |
}, |
| 87 |
UpdateAwsCluster: []gax.CallOption{ |
| 88 |
gax.WithTimeout(60000 * time.Millisecond), |
| 89 |
}, |
| 90 |
GetAwsCluster: []gax.CallOption{ |
| 91 |
gax.WithTimeout(60000 * time.Millisecond), |
| 92 |
gax.WithRetry(func() gax.Retryer { |
| 93 |
return gax.OnCodes([]codes.Code{ |
| 94 |
codes.Unavailable, |
| 95 |
}, gax.Backoff{ |
| 96 |
Initial: 1000 * time.Millisecond, |
| 97 |
Max: 10000 * time.Millisecond, |
| 98 |
Multiplier: 1.30, |
| 99 |
}) |
| 100 |
}), |
| 101 |
}, |
| 102 |
ListAwsClusters: []gax.CallOption{ |
| 103 |
gax.WithTimeout(60000 * time.Millisecond), |
| 104 |
gax.WithRetry(func() gax.Retryer { |
| 105 |
return gax.OnCodes([]codes.Code{ |
| 106 |
codes.Unavailable, |
| 107 |
}, gax.Backoff{ |
| 108 |
Initial: 1000 * time.Millisecond, |
| 109 |
Max: 10000 * time.Millisecond, |
| 110 |
Multiplier: 1.30, |
| 111 |
}) |
| 112 |
}), |
| 113 |
}, |
| 114 |
DeleteAwsCluster: []gax.CallOption{ |
| 115 |
gax.WithTimeout(60000 * time.Millisecond), |
| 116 |
}, |
| 117 |
GenerateAwsClusterAgentToken: []gax.CallOption{ |
| 118 |
gax.WithTimeout(60000 * time.Millisecond), |
| 119 |
gax.WithRetry(func() gax.Retryer { |
| 120 |
return gax.OnCodes([]codes.Code{ |
| 121 |
codes.Unavailable, |
| 122 |
}, gax.Backoff{ |
| 123 |
Initial: 1000 * time.Millisecond, |
| 124 |
Max: 10000 * time.Millisecond, |
| 125 |
Multiplier: 1.30, |
| 126 |
}) |
| 127 |
}), |
| 128 |
}, |
| 129 |
GenerateAwsAccessToken: []gax.CallOption{ |
| 130 |
gax.WithTimeout(60000 * time.Millisecond), |
| 131 |
gax.WithRetry(func() gax.Retryer { |
| 132 |
return gax.OnCodes([]codes.Code{ |
| 133 |
codes.Unavailable, |
| 134 |
}, gax.Backoff{ |
| 135 |
Initial: 1000 * time.Millisecond, |
| 136 |
Max: 10000 * time.Millisecond, |
| 137 |
Multiplier: 1.30, |
| 138 |
}) |
| 139 |
}), |
| 140 |
}, |
| 141 |
CreateAwsNodePool: []gax.CallOption{ |
| 142 |
gax.WithTimeout(60000 * time.Millisecond), |
| 143 |
}, |
| 144 |
UpdateAwsNodePool: []gax.CallOption{ |
| 145 |
gax.WithTimeout(60000 * time.Millisecond), |
| 146 |
}, |
| 147 |
RollbackAwsNodePoolUpdate: []gax.CallOption{ |
| 148 |
gax.WithTimeout(60000 * time.Millisecond), |
| 149 |
}, |
| 150 |
GetAwsNodePool: []gax.CallOption{ |
| 151 |
gax.WithTimeout(60000 * time.Millisecond), |
| 152 |
gax.WithRetry(func() gax.Retryer { |
| 153 |
return gax.OnCodes([]codes.Code{ |
| 154 |
codes.Unavailable, |
| 155 |
}, gax.Backoff{ |
| 156 |
Initial: 1000 * time.Millisecond, |
| 157 |
Max: 10000 * time.Millisecond, |
| 158 |
Multiplier: 1.30, |
| 159 |
}) |
| 160 |
}), |
| 161 |
}, |
| 162 |
ListAwsNodePools: []gax.CallOption{ |
| 163 |
gax.WithTimeout(60000 * time.Millisecond), |
| 164 |
gax.WithRetry(func() gax.Retryer { |
| 165 |
return gax.OnCodes([]codes.Code{ |
| 166 |
codes.Unavailable, |
| 167 |
}, gax.Backoff{ |
| 168 |
Initial: 1000 * time.Millisecond, |
| 169 |
Max: 10000 * time.Millisecond, |
| 170 |
Multiplier: 1.30, |
| 171 |
}) |
| 172 |
}), |
| 173 |
}, |
| 174 |
DeleteAwsNodePool: []gax.CallOption{ |
| 175 |
gax.WithTimeout(60000 * time.Millisecond), |
| 176 |
}, |
| 177 |
GetAwsOpenIdConfig: []gax.CallOption{ |
| 178 |
gax.WithTimeout(60000 * time.Millisecond), |
| 179 |
gax.WithRetry(func() gax.Retryer { |
| 180 |
return gax.OnCodes([]codes.Code{ |
| 181 |
codes.Unavailable, |
| 182 |
}, gax.Backoff{ |
| 183 |
Initial: 1000 * time.Millisecond, |
| 184 |
Max: 10000 * time.Millisecond, |
| 185 |
Multiplier: 1.30, |
| 186 |
}) |
| 187 |
}), |
| 188 |
}, |
| 189 |
GetAwsJsonWebKeys: []gax.CallOption{ |
| 190 |
gax.WithTimeout(60000 * time.Millisecond), |
| 191 |
gax.WithRetry(func() gax.Retryer { |
| 192 |
return gax.OnCodes([]codes.Code{ |
| 193 |
codes.Unavailable, |
| 194 |
}, gax.Backoff{ |
| 195 |
Initial: 1000 * time.Millisecond, |
| 196 |
Max: 10000 * time.Millisecond, |
| 197 |
Multiplier: 1.30, |
| 198 |
}) |
| 199 |
}), |
| 200 |
}, |
| 201 |
GetAwsServerConfig: []gax.CallOption{ |
| 202 |
gax.WithTimeout(60000 * time.Millisecond), |
| 203 |
gax.WithRetry(func() gax.Retryer { |
| 204 |
return gax.OnCodes([]codes.Code{ |
| 205 |
codes.Unavailable, |
| 206 |
}, gax.Backoff{ |
| 207 |
Initial: 1000 * time.Millisecond, |
| 208 |
Max: 10000 * time.Millisecond, |
| 209 |
Multiplier: 1.30, |
| 210 |
}) |
| 211 |
}), |
| 212 |
}, |
| 213 |
CancelOperation: []gax.CallOption{}, |
| 214 |
DeleteOperation: []gax.CallOption{}, |
| 215 |
GetOperation: []gax.CallOption{}, |
| 216 |
ListOperations: []gax.CallOption{}, |
| 217 |
} |
| 218 |
} |
| 219 |
|
| 220 |
|
| 221 |
type internalAwsClustersClient interface { |
| 222 |
Close() error |
| 223 |
setGoogleClientInfo(...string) |
| 224 |
Connection() *grpc.ClientConn |
| 225 |
CreateAwsCluster(context.Context, *gkemulticloudpb.CreateAwsClusterRequest, ...gax.CallOption) (*CreateAwsClusterOperation, error) |
| 226 |
CreateAwsClusterOperation(name string) *CreateAwsClusterOperation |
| 227 |
UpdateAwsCluster(context.Context, *gkemulticloudpb.UpdateAwsClusterRequest, ...gax.CallOption) (*UpdateAwsClusterOperation, error) |
| 228 |
UpdateAwsClusterOperation(name string) *UpdateAwsClusterOperation |
| 229 |
GetAwsCluster(context.Context, *gkemulticloudpb.GetAwsClusterRequest, ...gax.CallOption) (*gkemulticloudpb.AwsCluster, error) |
| 230 |
ListAwsClusters(context.Context, *gkemulticloudpb.ListAwsClustersRequest, ...gax.CallOption) *AwsClusterIterator |
| 231 |
DeleteAwsCluster(context.Context, *gkemulticloudpb.DeleteAwsClusterRequest, ...gax.CallOption) (*DeleteAwsClusterOperation, error) |
| 232 |
DeleteAwsClusterOperation(name string) *DeleteAwsClusterOperation |
| 233 |
GenerateAwsClusterAgentToken(context.Context, *gkemulticloudpb.GenerateAwsClusterAgentTokenRequest, ...gax.CallOption) (*gkemulticloudpb.GenerateAwsClusterAgentTokenResponse, error) |
| 234 |
GenerateAwsAccessToken(context.Context, *gkemulticloudpb.GenerateAwsAccessTokenRequest, ...gax.CallOption) (*gkemulticloudpb.GenerateAwsAccessTokenResponse, error) |
| 235 |
CreateAwsNodePool(context.Context, *gkemulticloudpb.CreateAwsNodePoolRequest, ...gax.CallOption) (*CreateAwsNodePoolOperation, error) |
| 236 |
CreateAwsNodePoolOperation(name string) *CreateAwsNodePoolOperation |
| 237 |
UpdateAwsNodePool(context.Context, *gkemulticloudpb.UpdateAwsNodePoolRequest, ...gax.CallOption) (*UpdateAwsNodePoolOperation, error) |
| 238 |
UpdateAwsNodePoolOperation(name string) *UpdateAwsNodePoolOperation |
| 239 |
RollbackAwsNodePoolUpdate(context.Context, *gkemulticloudpb.RollbackAwsNodePoolUpdateRequest, ...gax.CallOption) (*RollbackAwsNodePoolUpdateOperation, error) |
| 240 |
RollbackAwsNodePoolUpdateOperation(name string) *RollbackAwsNodePoolUpdateOperation |
| 241 |
GetAwsNodePool(context.Context, *gkemulticloudpb.GetAwsNodePoolRequest, ...gax.CallOption) (*gkemulticloudpb.AwsNodePool, error) |
| 242 |
ListAwsNodePools(context.Context, *gkemulticloudpb.ListAwsNodePoolsRequest, ...gax.CallOption) *AwsNodePoolIterator |
| 243 |
DeleteAwsNodePool(context.Context, *gkemulticloudpb.DeleteAwsNodePoolRequest, ...gax.CallOption) (*DeleteAwsNodePoolOperation, error) |
| 244 |
DeleteAwsNodePoolOperation(name string) *DeleteAwsNodePoolOperation |
| 245 |
GetAwsOpenIdConfig(context.Context, *gkemulticloudpb.GetAwsOpenIdConfigRequest, ...gax.CallOption) (*gkemulticloudpb.AwsOpenIdConfig, error) |
| 246 |
GetAwsJsonWebKeys(context.Context, *gkemulticloudpb.GetAwsJsonWebKeysRequest, ...gax.CallOption) (*gkemulticloudpb.AwsJsonWebKeys, error) |
| 247 |
GetAwsServerConfig(context.Context, *gkemulticloudpb.GetAwsServerConfigRequest, ...gax.CallOption) (*gkemulticloudpb.AwsServerConfig, error) |
| 248 |
CancelOperation(context.Context, *longrunningpb.CancelOperationRequest, ...gax.CallOption) error |
| 249 |
DeleteOperation(context.Context, *longrunningpb.DeleteOperationRequest, ...gax.CallOption) error |
| 250 |
GetOperation(context.Context, *longrunningpb.GetOperationRequest, ...gax.CallOption) (*longrunningpb.Operation, error) |
| 251 |
ListOperations(context.Context, *longrunningpb.ListOperationsRequest, ...gax.CallOption) *OperationIterator |
| 252 |
} |
| 253 |
|
| 254 |
|
| 255 |
|
| 256 |
|
| 257 |
|
| 258 |
|
| 259 |
type AwsClustersClient struct { |
| 260 |
|
| 261 |
internalClient internalAwsClustersClient |
| 262 |
|
| 263 |
|
| 264 |
CallOptions *AwsClustersCallOptions |
| 265 |
|
| 266 |
|
| 267 |
|
| 268 |
|
| 269 |
LROClient *lroauto.OperationsClient |
| 270 |
} |
| 271 |
|
| 272 |
|
| 273 |
|
| 274 |
|
| 275 |
|
| 276 |
func (c *AwsClustersClient) Close() error { |
| 277 |
return c.internalClient.Close() |
| 278 |
} |
| 279 |
|
| 280 |
|
| 281 |
|
| 282 |
|
| 283 |
func (c *AwsClustersClient) setGoogleClientInfo(keyval ...string) { |
| 284 |
c.internalClient.setGoogleClientInfo(keyval...) |
| 285 |
} |
| 286 |
|
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
|
| 291 |
func (c *AwsClustersClient) Connection() *grpc.ClientConn { |
| 292 |
return c.internalClient.Connection() |
| 293 |
} |
| 294 |
|
| 295 |
|
| 296 |
|
| 297 |
|
| 298 |
|
| 299 |
|
| 300 |
|
| 301 |
func (c *AwsClustersClient) CreateAwsCluster(ctx context.Context, req *gkemulticloudpb.CreateAwsClusterRequest, opts ...gax.CallOption) (*CreateAwsClusterOperation, error) { |
| 302 |
return c.internalClient.CreateAwsCluster(ctx, req, opts...) |
| 303 |
} |
| 304 |
|
| 305 |
|
| 306 |
|
| 307 |
func (c *AwsClustersClient) CreateAwsClusterOperation(name string) *CreateAwsClusterOperation { |
| 308 |
return c.internalClient.CreateAwsClusterOperation(name) |
| 309 |
} |
| 310 |
|
| 311 |
|
| 312 |
func (c *AwsClustersClient) UpdateAwsCluster(ctx context.Context, req *gkemulticloudpb.UpdateAwsClusterRequest, opts ...gax.CallOption) (*UpdateAwsClusterOperation, error) { |
| 313 |
return c.internalClient.UpdateAwsCluster(ctx, req, opts...) |
| 314 |
} |
| 315 |
|
| 316 |
|
| 317 |
|
| 318 |
func (c *AwsClustersClient) UpdateAwsClusterOperation(name string) *UpdateAwsClusterOperation { |
| 319 |
return c.internalClient.UpdateAwsClusterOperation(name) |
| 320 |
} |
| 321 |
|
| 322 |
|
| 323 |
|
| 324 |
func (c *AwsClustersClient) GetAwsCluster(ctx context.Context, req *gkemulticloudpb.GetAwsClusterRequest, opts ...gax.CallOption) (*gkemulticloudpb.AwsCluster, error) { |
| 325 |
return c.internalClient.GetAwsCluster(ctx, req, opts...) |
| 326 |
} |
| 327 |
|
| 328 |
|
| 329 |
|
| 330 |
func (c *AwsClustersClient) ListAwsClusters(ctx context.Context, req *gkemulticloudpb.ListAwsClustersRequest, opts ...gax.CallOption) *AwsClusterIterator { |
| 331 |
return c.internalClient.ListAwsClusters(ctx, req, opts...) |
| 332 |
} |
| 333 |
|
| 334 |
|
| 335 |
|
| 336 |
|
| 337 |
|
| 338 |
|
| 339 |
|
| 340 |
|
| 341 |
|
| 342 |
|
| 343 |
func (c *AwsClustersClient) DeleteAwsCluster(ctx context.Context, req *gkemulticloudpb.DeleteAwsClusterRequest, opts ...gax.CallOption) (*DeleteAwsClusterOperation, error) { |
| 344 |
return c.internalClient.DeleteAwsCluster(ctx, req, opts...) |
| 345 |
} |
| 346 |
|
| 347 |
|
| 348 |
|
| 349 |
func (c *AwsClustersClient) DeleteAwsClusterOperation(name string) *DeleteAwsClusterOperation { |
| 350 |
return c.internalClient.DeleteAwsClusterOperation(name) |
| 351 |
} |
| 352 |
|
| 353 |
|
| 354 |
func (c *AwsClustersClient) GenerateAwsClusterAgentToken(ctx context.Context, req *gkemulticloudpb.GenerateAwsClusterAgentTokenRequest, opts ...gax.CallOption) (*gkemulticloudpb.GenerateAwsClusterAgentTokenResponse, error) { |
| 355 |
return c.internalClient.GenerateAwsClusterAgentToken(ctx, req, opts...) |
| 356 |
} |
| 357 |
|
| 358 |
|
| 359 |
|
| 360 |
func (c *AwsClustersClient) GenerateAwsAccessToken(ctx context.Context, req *gkemulticloudpb.GenerateAwsAccessTokenRequest, opts ...gax.CallOption) (*gkemulticloudpb.GenerateAwsAccessTokenResponse, error) { |
| 361 |
return c.internalClient.GenerateAwsAccessToken(ctx, req, opts...) |
| 362 |
} |
| 363 |
|
| 364 |
|
| 365 |
|
| 366 |
|
| 367 |
|
| 368 |
|
| 369 |
|
| 370 |
func (c *AwsClustersClient) CreateAwsNodePool(ctx context.Context, req *gkemulticloudpb.CreateAwsNodePoolRequest, opts ...gax.CallOption) (*CreateAwsNodePoolOperation, error) { |
| 371 |
return c.internalClient.CreateAwsNodePool(ctx, req, opts...) |
| 372 |
} |
| 373 |
|
| 374 |
|
| 375 |
|
| 376 |
func (c *AwsClustersClient) CreateAwsNodePoolOperation(name string) *CreateAwsNodePoolOperation { |
| 377 |
return c.internalClient.CreateAwsNodePoolOperation(name) |
| 378 |
} |
| 379 |
|
| 380 |
|
| 381 |
func (c *AwsClustersClient) UpdateAwsNodePool(ctx context.Context, req *gkemulticloudpb.UpdateAwsNodePoolRequest, opts ...gax.CallOption) (*UpdateAwsNodePoolOperation, error) { |
| 382 |
return c.internalClient.UpdateAwsNodePool(ctx, req, opts...) |
| 383 |
} |
| 384 |
|
| 385 |
|
| 386 |
|
| 387 |
func (c *AwsClustersClient) UpdateAwsNodePoolOperation(name string) *UpdateAwsNodePoolOperation { |
| 388 |
return c.internalClient.UpdateAwsNodePoolOperation(name) |
| 389 |
} |
| 390 |
|
| 391 |
|
| 392 |
|
| 393 |
|
| 394 |
|
| 395 |
|
| 396 |
|
| 397 |
func (c *AwsClustersClient) RollbackAwsNodePoolUpdate(ctx context.Context, req *gkemulticloudpb.RollbackAwsNodePoolUpdateRequest, opts ...gax.CallOption) (*RollbackAwsNodePoolUpdateOperation, error) { |
| 398 |
return c.internalClient.RollbackAwsNodePoolUpdate(ctx, req, opts...) |
| 399 |
} |
| 400 |
|
| 401 |
|
| 402 |
|
| 403 |
func (c *AwsClustersClient) RollbackAwsNodePoolUpdateOperation(name string) *RollbackAwsNodePoolUpdateOperation { |
| 404 |
return c.internalClient.RollbackAwsNodePoolUpdateOperation(name) |
| 405 |
} |
| 406 |
|
| 407 |
|
| 408 |
|
| 409 |
func (c *AwsClustersClient) GetAwsNodePool(ctx context.Context, req *gkemulticloudpb.GetAwsNodePoolRequest, opts ...gax.CallOption) (*gkemulticloudpb.AwsNodePool, error) { |
| 410 |
return c.internalClient.GetAwsNodePool(ctx, req, opts...) |
| 411 |
} |
| 412 |
|
| 413 |
|
| 414 |
|
| 415 |
|
| 416 |
func (c *AwsClustersClient) ListAwsNodePools(ctx context.Context, req *gkemulticloudpb.ListAwsNodePoolsRequest, opts ...gax.CallOption) *AwsNodePoolIterator { |
| 417 |
return c.internalClient.ListAwsNodePools(ctx, req, opts...) |
| 418 |
} |
| 419 |
|
| 420 |
|
| 421 |
|
| 422 |
|
| 423 |
|
| 424 |
|
| 425 |
|
| 426 |
func (c *AwsClustersClient) DeleteAwsNodePool(ctx context.Context, req *gkemulticloudpb.DeleteAwsNodePoolRequest, opts ...gax.CallOption) (*DeleteAwsNodePoolOperation, error) { |
| 427 |
return c.internalClient.DeleteAwsNodePool(ctx, req, opts...) |
| 428 |
} |
| 429 |
|
| 430 |
|
| 431 |
|
| 432 |
func (c *AwsClustersClient) DeleteAwsNodePoolOperation(name string) *DeleteAwsNodePoolOperation { |
| 433 |
return c.internalClient.DeleteAwsNodePoolOperation(name) |
| 434 |
} |
| 435 |
|
| 436 |
|
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
|
| 441 |
func (c *AwsClustersClient) GetAwsOpenIdConfig(ctx context.Context, req *gkemulticloudpb.GetAwsOpenIdConfigRequest, opts ...gax.CallOption) (*gkemulticloudpb.AwsOpenIdConfig, error) { |
| 442 |
return c.internalClient.GetAwsOpenIdConfig(ctx, req, opts...) |
| 443 |
} |
| 444 |
|
| 445 |
|
| 446 |
|
| 447 |
func (c *AwsClustersClient) GetAwsJsonWebKeys(ctx context.Context, req *gkemulticloudpb.GetAwsJsonWebKeysRequest, opts ...gax.CallOption) (*gkemulticloudpb.AwsJsonWebKeys, error) { |
| 448 |
return c.internalClient.GetAwsJsonWebKeys(ctx, req, opts...) |
| 449 |
} |
| 450 |
|
| 451 |
|
| 452 |
|
| 453 |
func (c *AwsClustersClient) GetAwsServerConfig(ctx context.Context, req *gkemulticloudpb.GetAwsServerConfigRequest, opts ...gax.CallOption) (*gkemulticloudpb.AwsServerConfig, error) { |
| 454 |
return c.internalClient.GetAwsServerConfig(ctx, req, opts...) |
| 455 |
} |
| 456 |
|
| 457 |
|
| 458 |
func (c *AwsClustersClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { |
| 459 |
return c.internalClient.CancelOperation(ctx, req, opts...) |
| 460 |
} |
| 461 |
|
| 462 |
|
| 463 |
func (c *AwsClustersClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { |
| 464 |
return c.internalClient.DeleteOperation(ctx, req, opts...) |
| 465 |
} |
| 466 |
|
| 467 |
|
| 468 |
func (c *AwsClustersClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { |
| 469 |
return c.internalClient.GetOperation(ctx, req, opts...) |
| 470 |
} |
| 471 |
|
| 472 |
|
| 473 |
func (c *AwsClustersClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { |
| 474 |
return c.internalClient.ListOperations(ctx, req, opts...) |
| 475 |
} |
| 476 |
|
| 477 |
|
| 478 |
|
| 479 |
|
| 480 |
type awsClustersGRPCClient struct { |
| 481 |
|
| 482 |
connPool gtransport.ConnPool |
| 483 |
|
| 484 |
|
| 485 |
CallOptions **AwsClustersCallOptions |
| 486 |
|
| 487 |
|
| 488 |
awsClustersClient gkemulticloudpb.AwsClustersClient |
| 489 |
|
| 490 |
|
| 491 |
|
| 492 |
|
| 493 |
LROClient **lroauto.OperationsClient |
| 494 |
|
| 495 |
operationsClient longrunningpb.OperationsClient |
| 496 |
|
| 497 |
|
| 498 |
xGoogHeaders []string |
| 499 |
|
| 500 |
logger *slog.Logger |
| 501 |
} |
| 502 |
|
| 503 |
|
| 504 |
|
| 505 |
|
| 506 |
|
| 507 |
|
| 508 |
func NewAwsClustersClient(ctx context.Context, opts ...option.ClientOption) (*AwsClustersClient, error) { |
| 509 |
clientOpts := defaultAwsClustersGRPCClientOptions() |
| 510 |
if newAwsClustersClientHook != nil { |
| 511 |
hookOpts, err := newAwsClustersClientHook(ctx, clientHookParams{}) |
| 512 |
if err != nil { |
| 513 |
return nil, err |
| 514 |
} |
| 515 |
clientOpts = append(clientOpts, hookOpts...) |
| 516 |
} |
| 517 |
|
| 518 |
connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) |
| 519 |
if err != nil { |
| 520 |
return nil, err |
| 521 |
} |
| 522 |
client := AwsClustersClient{CallOptions: defaultAwsClustersCallOptions()} |
| 523 |
|
| 524 |
c := &awsClustersGRPCClient{ |
| 525 |
connPool: connPool, |
| 526 |
awsClustersClient: gkemulticloudpb.NewAwsClustersClient(connPool), |
| 527 |
CallOptions: &client.CallOptions, |
| 528 |
logger: internaloption.GetLogger(opts), |
| 529 |
operationsClient: longrunningpb.NewOperationsClient(connPool), |
| 530 |
} |
| 531 |
c.setGoogleClientInfo() |
| 532 |
|
| 533 |
client.internalClient = c |
| 534 |
|
| 535 |
client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) |
| 536 |
if err != nil { |
| 537 |
|
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
|
| 543 |
return nil, err |
| 544 |
} |
| 545 |
c.LROClient = &client.LROClient |
| 546 |
return &client, nil |
| 547 |
} |
| 548 |
|
| 549 |
|
| 550 |
|
| 551 |
|
| 552 |
|
| 553 |
func (c *awsClustersGRPCClient) Connection() *grpc.ClientConn { |
| 554 |
return c.connPool.Conn() |
| 555 |
} |
| 556 |
|
| 557 |
|
| 558 |
|
| 559 |
|
| 560 |
func (c *awsClustersGRPCClient) setGoogleClientInfo(keyval ...string) { |
| 561 |
kv := append([]string{"gl-go", gax.GoVersion}, keyval...) |
| 562 |
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion) |
| 563 |
c.xGoogHeaders = []string{ |
| 564 |
"x-goog-api-client", gax.XGoogHeader(kv...), |
| 565 |
} |
| 566 |
} |
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
func (c *awsClustersGRPCClient) Close() error { |
| 571 |
return c.connPool.Close() |
| 572 |
} |
| 573 |
|
| 574 |
func (c *awsClustersGRPCClient) CreateAwsCluster(ctx context.Context, req *gkemulticloudpb.CreateAwsClusterRequest, opts ...gax.CallOption) (*CreateAwsClusterOperation, error) { |
| 575 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 576 |
|
| 577 |
hds = append(c.xGoogHeaders, hds...) |
| 578 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 579 |
opts = append((*c.CallOptions).CreateAwsCluster[0:len((*c.CallOptions).CreateAwsCluster):len((*c.CallOptions).CreateAwsCluster)], opts...) |
| 580 |
var resp *longrunningpb.Operation |
| 581 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 582 |
var err error |
| 583 |
resp, err = executeRPC(ctx, c.awsClustersClient.CreateAwsCluster, req, settings.GRPC, c.logger, "CreateAwsCluster") |
| 584 |
return err |
| 585 |
}, opts...) |
| 586 |
if err != nil { |
| 587 |
return nil, err |
| 588 |
} |
| 589 |
return &CreateAwsClusterOperation{ |
| 590 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 591 |
}, nil |
| 592 |
} |
| 593 |
|
| 594 |
func (c *awsClustersGRPCClient) UpdateAwsCluster(ctx context.Context, req *gkemulticloudpb.UpdateAwsClusterRequest, opts ...gax.CallOption) (*UpdateAwsClusterOperation, error) { |
| 595 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "aws_cluster.name", url.QueryEscape(req.GetAwsCluster().GetName()))} |
| 596 |
|
| 597 |
hds = append(c.xGoogHeaders, hds...) |
| 598 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 599 |
opts = append((*c.CallOptions).UpdateAwsCluster[0:len((*c.CallOptions).UpdateAwsCluster):len((*c.CallOptions).UpdateAwsCluster)], opts...) |
| 600 |
var resp *longrunningpb.Operation |
| 601 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 602 |
var err error |
| 603 |
resp, err = executeRPC(ctx, c.awsClustersClient.UpdateAwsCluster, req, settings.GRPC, c.logger, "UpdateAwsCluster") |
| 604 |
return err |
| 605 |
}, opts...) |
| 606 |
if err != nil { |
| 607 |
return nil, err |
| 608 |
} |
| 609 |
return &UpdateAwsClusterOperation{ |
| 610 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 611 |
}, nil |
| 612 |
} |
| 613 |
|
| 614 |
func (c *awsClustersGRPCClient) GetAwsCluster(ctx context.Context, req *gkemulticloudpb.GetAwsClusterRequest, opts ...gax.CallOption) (*gkemulticloudpb.AwsCluster, error) { |
| 615 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 616 |
|
| 617 |
hds = append(c.xGoogHeaders, hds...) |
| 618 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 619 |
opts = append((*c.CallOptions).GetAwsCluster[0:len((*c.CallOptions).GetAwsCluster):len((*c.CallOptions).GetAwsCluster)], opts...) |
| 620 |
var resp *gkemulticloudpb.AwsCluster |
| 621 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 622 |
var err error |
| 623 |
resp, err = executeRPC(ctx, c.awsClustersClient.GetAwsCluster, req, settings.GRPC, c.logger, "GetAwsCluster") |
| 624 |
return err |
| 625 |
}, opts...) |
| 626 |
if err != nil { |
| 627 |
return nil, err |
| 628 |
} |
| 629 |
return resp, nil |
| 630 |
} |
| 631 |
|
| 632 |
func (c *awsClustersGRPCClient) ListAwsClusters(ctx context.Context, req *gkemulticloudpb.ListAwsClustersRequest, opts ...gax.CallOption) *AwsClusterIterator { |
| 633 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 634 |
|
| 635 |
hds = append(c.xGoogHeaders, hds...) |
| 636 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 637 |
opts = append((*c.CallOptions).ListAwsClusters[0:len((*c.CallOptions).ListAwsClusters):len((*c.CallOptions).ListAwsClusters)], opts...) |
| 638 |
it := &AwsClusterIterator{} |
| 639 |
req = proto.Clone(req).(*gkemulticloudpb.ListAwsClustersRequest) |
| 640 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*gkemulticloudpb.AwsCluster, string, error) { |
| 641 |
resp := &gkemulticloudpb.ListAwsClustersResponse{} |
| 642 |
if pageToken != "" { |
| 643 |
req.PageToken = pageToken |
| 644 |
} |
| 645 |
if pageSize > math.MaxInt32 { |
| 646 |
req.PageSize = math.MaxInt32 |
| 647 |
} else if pageSize != 0 { |
| 648 |
req.PageSize = int32(pageSize) |
| 649 |
} |
| 650 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 651 |
var err error |
| 652 |
resp, err = executeRPC(ctx, c.awsClustersClient.ListAwsClusters, req, settings.GRPC, c.logger, "ListAwsClusters") |
| 653 |
return err |
| 654 |
}, opts...) |
| 655 |
if err != nil { |
| 656 |
return nil, "", err |
| 657 |
} |
| 658 |
|
| 659 |
it.Response = resp |
| 660 |
return resp.GetAwsClusters(), resp.GetNextPageToken(), nil |
| 661 |
} |
| 662 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 663 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 664 |
if err != nil { |
| 665 |
return "", err |
| 666 |
} |
| 667 |
it.items = append(it.items, items...) |
| 668 |
return nextPageToken, nil |
| 669 |
} |
| 670 |
|
| 671 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 672 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 673 |
it.pageInfo.Token = req.GetPageToken() |
| 674 |
|
| 675 |
return it |
| 676 |
} |
| 677 |
|
| 678 |
func (c *awsClustersGRPCClient) DeleteAwsCluster(ctx context.Context, req *gkemulticloudpb.DeleteAwsClusterRequest, opts ...gax.CallOption) (*DeleteAwsClusterOperation, error) { |
| 679 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 680 |
|
| 681 |
hds = append(c.xGoogHeaders, hds...) |
| 682 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 683 |
opts = append((*c.CallOptions).DeleteAwsCluster[0:len((*c.CallOptions).DeleteAwsCluster):len((*c.CallOptions).DeleteAwsCluster)], opts...) |
| 684 |
var resp *longrunningpb.Operation |
| 685 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 686 |
var err error |
| 687 |
resp, err = executeRPC(ctx, c.awsClustersClient.DeleteAwsCluster, req, settings.GRPC, c.logger, "DeleteAwsCluster") |
| 688 |
return err |
| 689 |
}, opts...) |
| 690 |
if err != nil { |
| 691 |
return nil, err |
| 692 |
} |
| 693 |
return &DeleteAwsClusterOperation{ |
| 694 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 695 |
}, nil |
| 696 |
} |
| 697 |
|
| 698 |
func (c *awsClustersGRPCClient) GenerateAwsClusterAgentToken(ctx context.Context, req *gkemulticloudpb.GenerateAwsClusterAgentTokenRequest, opts ...gax.CallOption) (*gkemulticloudpb.GenerateAwsClusterAgentTokenResponse, error) { |
| 699 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "aws_cluster", url.QueryEscape(req.GetAwsCluster()))} |
| 700 |
|
| 701 |
hds = append(c.xGoogHeaders, hds...) |
| 702 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 703 |
opts = append((*c.CallOptions).GenerateAwsClusterAgentToken[0:len((*c.CallOptions).GenerateAwsClusterAgentToken):len((*c.CallOptions).GenerateAwsClusterAgentToken)], opts...) |
| 704 |
var resp *gkemulticloudpb.GenerateAwsClusterAgentTokenResponse |
| 705 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 706 |
var err error |
| 707 |
resp, err = executeRPC(ctx, c.awsClustersClient.GenerateAwsClusterAgentToken, req, settings.GRPC, c.logger, "GenerateAwsClusterAgentToken") |
| 708 |
return err |
| 709 |
}, opts...) |
| 710 |
if err != nil { |
| 711 |
return nil, err |
| 712 |
} |
| 713 |
return resp, nil |
| 714 |
} |
| 715 |
|
| 716 |
func (c *awsClustersGRPCClient) GenerateAwsAccessToken(ctx context.Context, req *gkemulticloudpb.GenerateAwsAccessTokenRequest, opts ...gax.CallOption) (*gkemulticloudpb.GenerateAwsAccessTokenResponse, error) { |
| 717 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "aws_cluster", url.QueryEscape(req.GetAwsCluster()))} |
| 718 |
|
| 719 |
hds = append(c.xGoogHeaders, hds...) |
| 720 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 721 |
opts = append((*c.CallOptions).GenerateAwsAccessToken[0:len((*c.CallOptions).GenerateAwsAccessToken):len((*c.CallOptions).GenerateAwsAccessToken)], opts...) |
| 722 |
var resp *gkemulticloudpb.GenerateAwsAccessTokenResponse |
| 723 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 724 |
var err error |
| 725 |
resp, err = executeRPC(ctx, c.awsClustersClient.GenerateAwsAccessToken, req, settings.GRPC, c.logger, "GenerateAwsAccessToken") |
| 726 |
return err |
| 727 |
}, opts...) |
| 728 |
if err != nil { |
| 729 |
return nil, err |
| 730 |
} |
| 731 |
return resp, nil |
| 732 |
} |
| 733 |
|
| 734 |
func (c *awsClustersGRPCClient) CreateAwsNodePool(ctx context.Context, req *gkemulticloudpb.CreateAwsNodePoolRequest, opts ...gax.CallOption) (*CreateAwsNodePoolOperation, error) { |
| 735 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 736 |
|
| 737 |
hds = append(c.xGoogHeaders, hds...) |
| 738 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 739 |
opts = append((*c.CallOptions).CreateAwsNodePool[0:len((*c.CallOptions).CreateAwsNodePool):len((*c.CallOptions).CreateAwsNodePool)], opts...) |
| 740 |
var resp *longrunningpb.Operation |
| 741 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 742 |
var err error |
| 743 |
resp, err = executeRPC(ctx, c.awsClustersClient.CreateAwsNodePool, req, settings.GRPC, c.logger, "CreateAwsNodePool") |
| 744 |
return err |
| 745 |
}, opts...) |
| 746 |
if err != nil { |
| 747 |
return nil, err |
| 748 |
} |
| 749 |
return &CreateAwsNodePoolOperation{ |
| 750 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 751 |
}, nil |
| 752 |
} |
| 753 |
|
| 754 |
func (c *awsClustersGRPCClient) UpdateAwsNodePool(ctx context.Context, req *gkemulticloudpb.UpdateAwsNodePoolRequest, opts ...gax.CallOption) (*UpdateAwsNodePoolOperation, error) { |
| 755 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "aws_node_pool.name", url.QueryEscape(req.GetAwsNodePool().GetName()))} |
| 756 |
|
| 757 |
hds = append(c.xGoogHeaders, hds...) |
| 758 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 759 |
opts = append((*c.CallOptions).UpdateAwsNodePool[0:len((*c.CallOptions).UpdateAwsNodePool):len((*c.CallOptions).UpdateAwsNodePool)], opts...) |
| 760 |
var resp *longrunningpb.Operation |
| 761 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 762 |
var err error |
| 763 |
resp, err = executeRPC(ctx, c.awsClustersClient.UpdateAwsNodePool, req, settings.GRPC, c.logger, "UpdateAwsNodePool") |
| 764 |
return err |
| 765 |
}, opts...) |
| 766 |
if err != nil { |
| 767 |
return nil, err |
| 768 |
} |
| 769 |
return &UpdateAwsNodePoolOperation{ |
| 770 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 771 |
}, nil |
| 772 |
} |
| 773 |
|
| 774 |
func (c *awsClustersGRPCClient) RollbackAwsNodePoolUpdate(ctx context.Context, req *gkemulticloudpb.RollbackAwsNodePoolUpdateRequest, opts ...gax.CallOption) (*RollbackAwsNodePoolUpdateOperation, error) { |
| 775 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 776 |
|
| 777 |
hds = append(c.xGoogHeaders, hds...) |
| 778 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 779 |
opts = append((*c.CallOptions).RollbackAwsNodePoolUpdate[0:len((*c.CallOptions).RollbackAwsNodePoolUpdate):len((*c.CallOptions).RollbackAwsNodePoolUpdate)], opts...) |
| 780 |
var resp *longrunningpb.Operation |
| 781 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 782 |
var err error |
| 783 |
resp, err = executeRPC(ctx, c.awsClustersClient.RollbackAwsNodePoolUpdate, req, settings.GRPC, c.logger, "RollbackAwsNodePoolUpdate") |
| 784 |
return err |
| 785 |
}, opts...) |
| 786 |
if err != nil { |
| 787 |
return nil, err |
| 788 |
} |
| 789 |
return &RollbackAwsNodePoolUpdateOperation{ |
| 790 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 791 |
}, nil |
| 792 |
} |
| 793 |
|
| 794 |
func (c *awsClustersGRPCClient) GetAwsNodePool(ctx context.Context, req *gkemulticloudpb.GetAwsNodePoolRequest, opts ...gax.CallOption) (*gkemulticloudpb.AwsNodePool, error) { |
| 795 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 796 |
|
| 797 |
hds = append(c.xGoogHeaders, hds...) |
| 798 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 799 |
opts = append((*c.CallOptions).GetAwsNodePool[0:len((*c.CallOptions).GetAwsNodePool):len((*c.CallOptions).GetAwsNodePool)], opts...) |
| 800 |
var resp *gkemulticloudpb.AwsNodePool |
| 801 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 802 |
var err error |
| 803 |
resp, err = executeRPC(ctx, c.awsClustersClient.GetAwsNodePool, req, settings.GRPC, c.logger, "GetAwsNodePool") |
| 804 |
return err |
| 805 |
}, opts...) |
| 806 |
if err != nil { |
| 807 |
return nil, err |
| 808 |
} |
| 809 |
return resp, nil |
| 810 |
} |
| 811 |
|
| 812 |
func (c *awsClustersGRPCClient) ListAwsNodePools(ctx context.Context, req *gkemulticloudpb.ListAwsNodePoolsRequest, opts ...gax.CallOption) *AwsNodePoolIterator { |
| 813 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 814 |
|
| 815 |
hds = append(c.xGoogHeaders, hds...) |
| 816 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 817 |
opts = append((*c.CallOptions).ListAwsNodePools[0:len((*c.CallOptions).ListAwsNodePools):len((*c.CallOptions).ListAwsNodePools)], opts...) |
| 818 |
it := &AwsNodePoolIterator{} |
| 819 |
req = proto.Clone(req).(*gkemulticloudpb.ListAwsNodePoolsRequest) |
| 820 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*gkemulticloudpb.AwsNodePool, string, error) { |
| 821 |
resp := &gkemulticloudpb.ListAwsNodePoolsResponse{} |
| 822 |
if pageToken != "" { |
| 823 |
req.PageToken = pageToken |
| 824 |
} |
| 825 |
if pageSize > math.MaxInt32 { |
| 826 |
req.PageSize = math.MaxInt32 |
| 827 |
} else if pageSize != 0 { |
| 828 |
req.PageSize = int32(pageSize) |
| 829 |
} |
| 830 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 831 |
var err error |
| 832 |
resp, err = executeRPC(ctx, c.awsClustersClient.ListAwsNodePools, req, settings.GRPC, c.logger, "ListAwsNodePools") |
| 833 |
return err |
| 834 |
}, opts...) |
| 835 |
if err != nil { |
| 836 |
return nil, "", err |
| 837 |
} |
| 838 |
|
| 839 |
it.Response = resp |
| 840 |
return resp.GetAwsNodePools(), resp.GetNextPageToken(), nil |
| 841 |
} |
| 842 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 843 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 844 |
if err != nil { |
| 845 |
return "", err |
| 846 |
} |
| 847 |
it.items = append(it.items, items...) |
| 848 |
return nextPageToken, nil |
| 849 |
} |
| 850 |
|
| 851 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 852 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 853 |
it.pageInfo.Token = req.GetPageToken() |
| 854 |
|
| 855 |
return it |
| 856 |
} |
| 857 |
|
| 858 |
func (c *awsClustersGRPCClient) DeleteAwsNodePool(ctx context.Context, req *gkemulticloudpb.DeleteAwsNodePoolRequest, opts ...gax.CallOption) (*DeleteAwsNodePoolOperation, error) { |
| 859 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 860 |
|
| 861 |
hds = append(c.xGoogHeaders, hds...) |
| 862 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 863 |
opts = append((*c.CallOptions).DeleteAwsNodePool[0:len((*c.CallOptions).DeleteAwsNodePool):len((*c.CallOptions).DeleteAwsNodePool)], opts...) |
| 864 |
var resp *longrunningpb.Operation |
| 865 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 866 |
var err error |
| 867 |
resp, err = executeRPC(ctx, c.awsClustersClient.DeleteAwsNodePool, req, settings.GRPC, c.logger, "DeleteAwsNodePool") |
| 868 |
return err |
| 869 |
}, opts...) |
| 870 |
if err != nil { |
| 871 |
return nil, err |
| 872 |
} |
| 873 |
return &DeleteAwsNodePoolOperation{ |
| 874 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 875 |
}, nil |
| 876 |
} |
| 877 |
|
| 878 |
func (c *awsClustersGRPCClient) GetAwsOpenIdConfig(ctx context.Context, req *gkemulticloudpb.GetAwsOpenIdConfigRequest, opts ...gax.CallOption) (*gkemulticloudpb.AwsOpenIdConfig, error) { |
| 879 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "aws_cluster", url.QueryEscape(req.GetAwsCluster()))} |
| 880 |
|
| 881 |
hds = append(c.xGoogHeaders, hds...) |
| 882 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 883 |
opts = append((*c.CallOptions).GetAwsOpenIdConfig[0:len((*c.CallOptions).GetAwsOpenIdConfig):len((*c.CallOptions).GetAwsOpenIdConfig)], opts...) |
| 884 |
var resp *gkemulticloudpb.AwsOpenIdConfig |
| 885 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 886 |
var err error |
| 887 |
resp, err = executeRPC(ctx, c.awsClustersClient.GetAwsOpenIdConfig, req, settings.GRPC, c.logger, "GetAwsOpenIdConfig") |
| 888 |
return err |
| 889 |
}, opts...) |
| 890 |
if err != nil { |
| 891 |
return nil, err |
| 892 |
} |
| 893 |
return resp, nil |
| 894 |
} |
| 895 |
|
| 896 |
func (c *awsClustersGRPCClient) GetAwsJsonWebKeys(ctx context.Context, req *gkemulticloudpb.GetAwsJsonWebKeysRequest, opts ...gax.CallOption) (*gkemulticloudpb.AwsJsonWebKeys, error) { |
| 897 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "aws_cluster", url.QueryEscape(req.GetAwsCluster()))} |
| 898 |
|
| 899 |
hds = append(c.xGoogHeaders, hds...) |
| 900 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 901 |
opts = append((*c.CallOptions).GetAwsJsonWebKeys[0:len((*c.CallOptions).GetAwsJsonWebKeys):len((*c.CallOptions).GetAwsJsonWebKeys)], opts...) |
| 902 |
var resp *gkemulticloudpb.AwsJsonWebKeys |
| 903 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 904 |
var err error |
| 905 |
resp, err = executeRPC(ctx, c.awsClustersClient.GetAwsJsonWebKeys, req, settings.GRPC, c.logger, "GetAwsJsonWebKeys") |
| 906 |
return err |
| 907 |
}, opts...) |
| 908 |
if err != nil { |
| 909 |
return nil, err |
| 910 |
} |
| 911 |
return resp, nil |
| 912 |
} |
| 913 |
|
| 914 |
func (c *awsClustersGRPCClient) GetAwsServerConfig(ctx context.Context, req *gkemulticloudpb.GetAwsServerConfigRequest, opts ...gax.CallOption) (*gkemulticloudpb.AwsServerConfig, error) { |
| 915 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 916 |
|
| 917 |
hds = append(c.xGoogHeaders, hds...) |
| 918 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 919 |
opts = append((*c.CallOptions).GetAwsServerConfig[0:len((*c.CallOptions).GetAwsServerConfig):len((*c.CallOptions).GetAwsServerConfig)], opts...) |
| 920 |
var resp *gkemulticloudpb.AwsServerConfig |
| 921 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 922 |
var err error |
| 923 |
resp, err = executeRPC(ctx, c.awsClustersClient.GetAwsServerConfig, req, settings.GRPC, c.logger, "GetAwsServerConfig") |
| 924 |
return err |
| 925 |
}, opts...) |
| 926 |
if err != nil { |
| 927 |
return nil, err |
| 928 |
} |
| 929 |
return resp, nil |
| 930 |
} |
| 931 |
|
| 932 |
func (c *awsClustersGRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { |
| 933 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 934 |
|
| 935 |
hds = append(c.xGoogHeaders, hds...) |
| 936 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 937 |
opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...) |
| 938 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 939 |
var err error |
| 940 |
_, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation") |
| 941 |
return err |
| 942 |
}, opts...) |
| 943 |
return err |
| 944 |
} |
| 945 |
|
| 946 |
func (c *awsClustersGRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { |
| 947 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 948 |
|
| 949 |
hds = append(c.xGoogHeaders, hds...) |
| 950 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 951 |
opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...) |
| 952 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 953 |
var err error |
| 954 |
_, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation") |
| 955 |
return err |
| 956 |
}, opts...) |
| 957 |
return err |
| 958 |
} |
| 959 |
|
| 960 |
func (c *awsClustersGRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { |
| 961 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 962 |
|
| 963 |
hds = append(c.xGoogHeaders, hds...) |
| 964 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 965 |
opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) |
| 966 |
var resp *longrunningpb.Operation |
| 967 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 968 |
var err error |
| 969 |
resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation") |
| 970 |
return err |
| 971 |
}, opts...) |
| 972 |
if err != nil { |
| 973 |
return nil, err |
| 974 |
} |
| 975 |
return resp, nil |
| 976 |
} |
| 977 |
|
| 978 |
func (c *awsClustersGRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { |
| 979 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 980 |
|
| 981 |
hds = append(c.xGoogHeaders, hds...) |
| 982 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 983 |
opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...) |
| 984 |
it := &OperationIterator{} |
| 985 |
req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) |
| 986 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { |
| 987 |
resp := &longrunningpb.ListOperationsResponse{} |
| 988 |
if pageToken != "" { |
| 989 |
req.PageToken = pageToken |
| 990 |
} |
| 991 |
if pageSize > math.MaxInt32 { |
| 992 |
req.PageSize = math.MaxInt32 |
| 993 |
} else if pageSize != 0 { |
| 994 |
req.PageSize = int32(pageSize) |
| 995 |
} |
| 996 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 997 |
var err error |
| 998 |
resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations") |
| 999 |
return err |
| 1000 |
}, opts...) |
| 1001 |
if err != nil { |
| 1002 |
return nil, "", err |
| 1003 |
} |
| 1004 |
|
| 1005 |
it.Response = resp |
| 1006 |
return resp.GetOperations(), resp.GetNextPageToken(), nil |
| 1007 |
} |
| 1008 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1009 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1010 |
if err != nil { |
| 1011 |
return "", err |
| 1012 |
} |
| 1013 |
it.items = append(it.items, items...) |
| 1014 |
return nextPageToken, nil |
| 1015 |
} |
| 1016 |
|
| 1017 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1018 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1019 |
it.pageInfo.Token = req.GetPageToken() |
| 1020 |
|
| 1021 |
return it |
| 1022 |
} |
| 1023 |
|
| 1024 |
|
| 1025 |
|
| 1026 |
func (c *awsClustersGRPCClient) CreateAwsClusterOperation(name string) *CreateAwsClusterOperation { |
| 1027 |
return &CreateAwsClusterOperation{ |
| 1028 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 1029 |
} |
| 1030 |
} |
| 1031 |
|
| 1032 |
|
| 1033 |
|
| 1034 |
func (c *awsClustersGRPCClient) CreateAwsNodePoolOperation(name string) *CreateAwsNodePoolOperation { |
| 1035 |
return &CreateAwsNodePoolOperation{ |
| 1036 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 1037 |
} |
| 1038 |
} |
| 1039 |
|
| 1040 |
|
| 1041 |
|
| 1042 |
func (c *awsClustersGRPCClient) DeleteAwsClusterOperation(name string) *DeleteAwsClusterOperation { |
| 1043 |
return &DeleteAwsClusterOperation{ |
| 1044 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 1045 |
} |
| 1046 |
} |
| 1047 |
|
| 1048 |
|
| 1049 |
|
| 1050 |
func (c *awsClustersGRPCClient) DeleteAwsNodePoolOperation(name string) *DeleteAwsNodePoolOperation { |
| 1051 |
return &DeleteAwsNodePoolOperation{ |
| 1052 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 1053 |
} |
| 1054 |
} |
| 1055 |
|
| 1056 |
|
| 1057 |
|
| 1058 |
func (c *awsClustersGRPCClient) RollbackAwsNodePoolUpdateOperation(name string) *RollbackAwsNodePoolUpdateOperation { |
| 1059 |
return &RollbackAwsNodePoolUpdateOperation{ |
| 1060 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 1061 |
} |
| 1062 |
} |
| 1063 |
|
| 1064 |
|
| 1065 |
|
| 1066 |
func (c *awsClustersGRPCClient) UpdateAwsClusterOperation(name string) *UpdateAwsClusterOperation { |
| 1067 |
return &UpdateAwsClusterOperation{ |
| 1068 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 1069 |
} |
| 1070 |
} |
| 1071 |
|
| 1072 |
|
| 1073 |
|
| 1074 |
func (c *awsClustersGRPCClient) UpdateAwsNodePoolOperation(name string) *UpdateAwsNodePoolOperation { |
| 1075 |
return &UpdateAwsNodePoolOperation{ |
| 1076 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 1077 |
} |
| 1078 |
} |