| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package telcoautomation |
| 18 |
|
| 19 |
import ( |
| 20 |
"bytes" |
| 21 |
"context" |
| 22 |
"fmt" |
| 23 |
"log/slog" |
| 24 |
"math" |
| 25 |
"net/http" |
| 26 |
"net/url" |
| 27 |
|
| 28 |
"cloud.google.com/go/longrunning" |
| 29 |
lroauto "cloud.google.com/go/longrunning/autogen" |
| 30 |
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb" |
| 31 |
telcoautomationpb "cloud.google.com/go/telcoautomation/apiv1/telcoautomationpb" |
| 32 |
gax "github.com/googleapis/gax-go/v2" |
| 33 |
"google.golang.org/api/iterator" |
| 34 |
"google.golang.org/api/option" |
| 35 |
"google.golang.org/api/option/internaloption" |
| 36 |
gtransport "google.golang.org/api/transport/grpc" |
| 37 |
httptransport "google.golang.org/api/transport/http" |
| 38 |
locationpb "google.golang.org/genproto/googleapis/cloud/location" |
| 39 |
"google.golang.org/grpc" |
| 40 |
"google.golang.org/protobuf/encoding/protojson" |
| 41 |
"google.golang.org/protobuf/proto" |
| 42 |
) |
| 43 |
|
| 44 |
var newClientHook clientHook |
| 45 |
|
| 46 |
|
| 47 |
type CallOptions struct { |
| 48 |
ListOrchestrationClusters []gax.CallOption |
| 49 |
GetOrchestrationCluster []gax.CallOption |
| 50 |
CreateOrchestrationCluster []gax.CallOption |
| 51 |
DeleteOrchestrationCluster []gax.CallOption |
| 52 |
ListEdgeSlms []gax.CallOption |
| 53 |
GetEdgeSlm []gax.CallOption |
| 54 |
CreateEdgeSlm []gax.CallOption |
| 55 |
DeleteEdgeSlm []gax.CallOption |
| 56 |
CreateBlueprint []gax.CallOption |
| 57 |
UpdateBlueprint []gax.CallOption |
| 58 |
GetBlueprint []gax.CallOption |
| 59 |
DeleteBlueprint []gax.CallOption |
| 60 |
ListBlueprints []gax.CallOption |
| 61 |
ApproveBlueprint []gax.CallOption |
| 62 |
ProposeBlueprint []gax.CallOption |
| 63 |
RejectBlueprint []gax.CallOption |
| 64 |
ListBlueprintRevisions []gax.CallOption |
| 65 |
SearchBlueprintRevisions []gax.CallOption |
| 66 |
SearchDeploymentRevisions []gax.CallOption |
| 67 |
DiscardBlueprintChanges []gax.CallOption |
| 68 |
ListPublicBlueprints []gax.CallOption |
| 69 |
GetPublicBlueprint []gax.CallOption |
| 70 |
CreateDeployment []gax.CallOption |
| 71 |
UpdateDeployment []gax.CallOption |
| 72 |
GetDeployment []gax.CallOption |
| 73 |
RemoveDeployment []gax.CallOption |
| 74 |
ListDeployments []gax.CallOption |
| 75 |
ListDeploymentRevisions []gax.CallOption |
| 76 |
DiscardDeploymentChanges []gax.CallOption |
| 77 |
ApplyDeployment []gax.CallOption |
| 78 |
ComputeDeploymentStatus []gax.CallOption |
| 79 |
RollbackDeployment []gax.CallOption |
| 80 |
GetHydratedDeployment []gax.CallOption |
| 81 |
ListHydratedDeployments []gax.CallOption |
| 82 |
UpdateHydratedDeployment []gax.CallOption |
| 83 |
ApplyHydratedDeployment []gax.CallOption |
| 84 |
GetLocation []gax.CallOption |
| 85 |
ListLocations []gax.CallOption |
| 86 |
CancelOperation []gax.CallOption |
| 87 |
DeleteOperation []gax.CallOption |
| 88 |
GetOperation []gax.CallOption |
| 89 |
ListOperations []gax.CallOption |
| 90 |
} |
| 91 |
|
| 92 |
func defaultGRPCClientOptions() []option.ClientOption { |
| 93 |
return []option.ClientOption{ |
| 94 |
internaloption.WithDefaultEndpoint("telcoautomation.googleapis.com:443"), |
| 95 |
internaloption.WithDefaultEndpointTemplate("telcoautomation.UNIVERSE_DOMAIN:443"), |
| 96 |
internaloption.WithDefaultMTLSEndpoint("telcoautomation.mtls.googleapis.com:443"), |
| 97 |
internaloption.WithDefaultUniverseDomain("googleapis.com"), |
| 98 |
internaloption.WithDefaultAudience("https://telcoautomation.googleapis.com/"), |
| 99 |
internaloption.WithDefaultScopes(DefaultAuthScopes()...), |
| 100 |
internaloption.EnableJwtWithScope(), |
| 101 |
internaloption.EnableNewAuthLibrary(), |
| 102 |
option.WithGRPCDialOption(grpc.WithDefaultCallOptions( |
| 103 |
grpc.MaxCallRecvMsgSize(math.MaxInt32))), |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
func defaultCallOptions() *CallOptions { |
| 108 |
return &CallOptions{ |
| 109 |
ListOrchestrationClusters: []gax.CallOption{}, |
| 110 |
GetOrchestrationCluster: []gax.CallOption{}, |
| 111 |
CreateOrchestrationCluster: []gax.CallOption{}, |
| 112 |
DeleteOrchestrationCluster: []gax.CallOption{}, |
| 113 |
ListEdgeSlms: []gax.CallOption{}, |
| 114 |
GetEdgeSlm: []gax.CallOption{}, |
| 115 |
CreateEdgeSlm: []gax.CallOption{}, |
| 116 |
DeleteEdgeSlm: []gax.CallOption{}, |
| 117 |
CreateBlueprint: []gax.CallOption{}, |
| 118 |
UpdateBlueprint: []gax.CallOption{}, |
| 119 |
GetBlueprint: []gax.CallOption{}, |
| 120 |
DeleteBlueprint: []gax.CallOption{}, |
| 121 |
ListBlueprints: []gax.CallOption{}, |
| 122 |
ApproveBlueprint: []gax.CallOption{}, |
| 123 |
ProposeBlueprint: []gax.CallOption{}, |
| 124 |
RejectBlueprint: []gax.CallOption{}, |
| 125 |
ListBlueprintRevisions: []gax.CallOption{}, |
| 126 |
SearchBlueprintRevisions: []gax.CallOption{}, |
| 127 |
SearchDeploymentRevisions: []gax.CallOption{}, |
| 128 |
DiscardBlueprintChanges: []gax.CallOption{}, |
| 129 |
ListPublicBlueprints: []gax.CallOption{}, |
| 130 |
GetPublicBlueprint: []gax.CallOption{}, |
| 131 |
CreateDeployment: []gax.CallOption{}, |
| 132 |
UpdateDeployment: []gax.CallOption{}, |
| 133 |
GetDeployment: []gax.CallOption{}, |
| 134 |
RemoveDeployment: []gax.CallOption{}, |
| 135 |
ListDeployments: []gax.CallOption{}, |
| 136 |
ListDeploymentRevisions: []gax.CallOption{}, |
| 137 |
DiscardDeploymentChanges: []gax.CallOption{}, |
| 138 |
ApplyDeployment: []gax.CallOption{}, |
| 139 |
ComputeDeploymentStatus: []gax.CallOption{}, |
| 140 |
RollbackDeployment: []gax.CallOption{}, |
| 141 |
GetHydratedDeployment: []gax.CallOption{}, |
| 142 |
ListHydratedDeployments: []gax.CallOption{}, |
| 143 |
UpdateHydratedDeployment: []gax.CallOption{}, |
| 144 |
ApplyHydratedDeployment: []gax.CallOption{}, |
| 145 |
GetLocation: []gax.CallOption{}, |
| 146 |
ListLocations: []gax.CallOption{}, |
| 147 |
CancelOperation: []gax.CallOption{}, |
| 148 |
DeleteOperation: []gax.CallOption{}, |
| 149 |
GetOperation: []gax.CallOption{}, |
| 150 |
ListOperations: []gax.CallOption{}, |
| 151 |
} |
| 152 |
} |
| 153 |
|
| 154 |
func defaultRESTCallOptions() *CallOptions { |
| 155 |
return &CallOptions{ |
| 156 |
ListOrchestrationClusters: []gax.CallOption{}, |
| 157 |
GetOrchestrationCluster: []gax.CallOption{}, |
| 158 |
CreateOrchestrationCluster: []gax.CallOption{}, |
| 159 |
DeleteOrchestrationCluster: []gax.CallOption{}, |
| 160 |
ListEdgeSlms: []gax.CallOption{}, |
| 161 |
GetEdgeSlm: []gax.CallOption{}, |
| 162 |
CreateEdgeSlm: []gax.CallOption{}, |
| 163 |
DeleteEdgeSlm: []gax.CallOption{}, |
| 164 |
CreateBlueprint: []gax.CallOption{}, |
| 165 |
UpdateBlueprint: []gax.CallOption{}, |
| 166 |
GetBlueprint: []gax.CallOption{}, |
| 167 |
DeleteBlueprint: []gax.CallOption{}, |
| 168 |
ListBlueprints: []gax.CallOption{}, |
| 169 |
ApproveBlueprint: []gax.CallOption{}, |
| 170 |
ProposeBlueprint: []gax.CallOption{}, |
| 171 |
RejectBlueprint: []gax.CallOption{}, |
| 172 |
ListBlueprintRevisions: []gax.CallOption{}, |
| 173 |
SearchBlueprintRevisions: []gax.CallOption{}, |
| 174 |
SearchDeploymentRevisions: []gax.CallOption{}, |
| 175 |
DiscardBlueprintChanges: []gax.CallOption{}, |
| 176 |
ListPublicBlueprints: []gax.CallOption{}, |
| 177 |
GetPublicBlueprint: []gax.CallOption{}, |
| 178 |
CreateDeployment: []gax.CallOption{}, |
| 179 |
UpdateDeployment: []gax.CallOption{}, |
| 180 |
GetDeployment: []gax.CallOption{}, |
| 181 |
RemoveDeployment: []gax.CallOption{}, |
| 182 |
ListDeployments: []gax.CallOption{}, |
| 183 |
ListDeploymentRevisions: []gax.CallOption{}, |
| 184 |
DiscardDeploymentChanges: []gax.CallOption{}, |
| 185 |
ApplyDeployment: []gax.CallOption{}, |
| 186 |
ComputeDeploymentStatus: []gax.CallOption{}, |
| 187 |
RollbackDeployment: []gax.CallOption{}, |
| 188 |
GetHydratedDeployment: []gax.CallOption{}, |
| 189 |
ListHydratedDeployments: []gax.CallOption{}, |
| 190 |
UpdateHydratedDeployment: []gax.CallOption{}, |
| 191 |
ApplyHydratedDeployment: []gax.CallOption{}, |
| 192 |
GetLocation: []gax.CallOption{}, |
| 193 |
ListLocations: []gax.CallOption{}, |
| 194 |
CancelOperation: []gax.CallOption{}, |
| 195 |
DeleteOperation: []gax.CallOption{}, |
| 196 |
GetOperation: []gax.CallOption{}, |
| 197 |
ListOperations: []gax.CallOption{}, |
| 198 |
} |
| 199 |
} |
| 200 |
|
| 201 |
|
| 202 |
type internalClient interface { |
| 203 |
Close() error |
| 204 |
setGoogleClientInfo(...string) |
| 205 |
Connection() *grpc.ClientConn |
| 206 |
ListOrchestrationClusters(context.Context, *telcoautomationpb.ListOrchestrationClustersRequest, ...gax.CallOption) *OrchestrationClusterIterator |
| 207 |
GetOrchestrationCluster(context.Context, *telcoautomationpb.GetOrchestrationClusterRequest, ...gax.CallOption) (*telcoautomationpb.OrchestrationCluster, error) |
| 208 |
CreateOrchestrationCluster(context.Context, *telcoautomationpb.CreateOrchestrationClusterRequest, ...gax.CallOption) (*CreateOrchestrationClusterOperation, error) |
| 209 |
CreateOrchestrationClusterOperation(name string) *CreateOrchestrationClusterOperation |
| 210 |
DeleteOrchestrationCluster(context.Context, *telcoautomationpb.DeleteOrchestrationClusterRequest, ...gax.CallOption) (*DeleteOrchestrationClusterOperation, error) |
| 211 |
DeleteOrchestrationClusterOperation(name string) *DeleteOrchestrationClusterOperation |
| 212 |
ListEdgeSlms(context.Context, *telcoautomationpb.ListEdgeSlmsRequest, ...gax.CallOption) *EdgeSlmIterator |
| 213 |
GetEdgeSlm(context.Context, *telcoautomationpb.GetEdgeSlmRequest, ...gax.CallOption) (*telcoautomationpb.EdgeSlm, error) |
| 214 |
CreateEdgeSlm(context.Context, *telcoautomationpb.CreateEdgeSlmRequest, ...gax.CallOption) (*CreateEdgeSlmOperation, error) |
| 215 |
CreateEdgeSlmOperation(name string) *CreateEdgeSlmOperation |
| 216 |
DeleteEdgeSlm(context.Context, *telcoautomationpb.DeleteEdgeSlmRequest, ...gax.CallOption) (*DeleteEdgeSlmOperation, error) |
| 217 |
DeleteEdgeSlmOperation(name string) *DeleteEdgeSlmOperation |
| 218 |
CreateBlueprint(context.Context, *telcoautomationpb.CreateBlueprintRequest, ...gax.CallOption) (*telcoautomationpb.Blueprint, error) |
| 219 |
UpdateBlueprint(context.Context, *telcoautomationpb.UpdateBlueprintRequest, ...gax.CallOption) (*telcoautomationpb.Blueprint, error) |
| 220 |
GetBlueprint(context.Context, *telcoautomationpb.GetBlueprintRequest, ...gax.CallOption) (*telcoautomationpb.Blueprint, error) |
| 221 |
DeleteBlueprint(context.Context, *telcoautomationpb.DeleteBlueprintRequest, ...gax.CallOption) error |
| 222 |
ListBlueprints(context.Context, *telcoautomationpb.ListBlueprintsRequest, ...gax.CallOption) *BlueprintIterator |
| 223 |
ApproveBlueprint(context.Context, *telcoautomationpb.ApproveBlueprintRequest, ...gax.CallOption) (*telcoautomationpb.Blueprint, error) |
| 224 |
ProposeBlueprint(context.Context, *telcoautomationpb.ProposeBlueprintRequest, ...gax.CallOption) (*telcoautomationpb.Blueprint, error) |
| 225 |
RejectBlueprint(context.Context, *telcoautomationpb.RejectBlueprintRequest, ...gax.CallOption) (*telcoautomationpb.Blueprint, error) |
| 226 |
ListBlueprintRevisions(context.Context, *telcoautomationpb.ListBlueprintRevisionsRequest, ...gax.CallOption) *BlueprintIterator |
| 227 |
SearchBlueprintRevisions(context.Context, *telcoautomationpb.SearchBlueprintRevisionsRequest, ...gax.CallOption) *BlueprintIterator |
| 228 |
SearchDeploymentRevisions(context.Context, *telcoautomationpb.SearchDeploymentRevisionsRequest, ...gax.CallOption) *DeploymentIterator |
| 229 |
DiscardBlueprintChanges(context.Context, *telcoautomationpb.DiscardBlueprintChangesRequest, ...gax.CallOption) (*telcoautomationpb.DiscardBlueprintChangesResponse, error) |
| 230 |
ListPublicBlueprints(context.Context, *telcoautomationpb.ListPublicBlueprintsRequest, ...gax.CallOption) *PublicBlueprintIterator |
| 231 |
GetPublicBlueprint(context.Context, *telcoautomationpb.GetPublicBlueprintRequest, ...gax.CallOption) (*telcoautomationpb.PublicBlueprint, error) |
| 232 |
CreateDeployment(context.Context, *telcoautomationpb.CreateDeploymentRequest, ...gax.CallOption) (*telcoautomationpb.Deployment, error) |
| 233 |
UpdateDeployment(context.Context, *telcoautomationpb.UpdateDeploymentRequest, ...gax.CallOption) (*telcoautomationpb.Deployment, error) |
| 234 |
GetDeployment(context.Context, *telcoautomationpb.GetDeploymentRequest, ...gax.CallOption) (*telcoautomationpb.Deployment, error) |
| 235 |
RemoveDeployment(context.Context, *telcoautomationpb.RemoveDeploymentRequest, ...gax.CallOption) error |
| 236 |
ListDeployments(context.Context, *telcoautomationpb.ListDeploymentsRequest, ...gax.CallOption) *DeploymentIterator |
| 237 |
ListDeploymentRevisions(context.Context, *telcoautomationpb.ListDeploymentRevisionsRequest, ...gax.CallOption) *DeploymentIterator |
| 238 |
DiscardDeploymentChanges(context.Context, *telcoautomationpb.DiscardDeploymentChangesRequest, ...gax.CallOption) (*telcoautomationpb.DiscardDeploymentChangesResponse, error) |
| 239 |
ApplyDeployment(context.Context, *telcoautomationpb.ApplyDeploymentRequest, ...gax.CallOption) (*telcoautomationpb.Deployment, error) |
| 240 |
ComputeDeploymentStatus(context.Context, *telcoautomationpb.ComputeDeploymentStatusRequest, ...gax.CallOption) (*telcoautomationpb.ComputeDeploymentStatusResponse, error) |
| 241 |
RollbackDeployment(context.Context, *telcoautomationpb.RollbackDeploymentRequest, ...gax.CallOption) (*telcoautomationpb.Deployment, error) |
| 242 |
GetHydratedDeployment(context.Context, *telcoautomationpb.GetHydratedDeploymentRequest, ...gax.CallOption) (*telcoautomationpb.HydratedDeployment, error) |
| 243 |
ListHydratedDeployments(context.Context, *telcoautomationpb.ListHydratedDeploymentsRequest, ...gax.CallOption) *HydratedDeploymentIterator |
| 244 |
UpdateHydratedDeployment(context.Context, *telcoautomationpb.UpdateHydratedDeploymentRequest, ...gax.CallOption) (*telcoautomationpb.HydratedDeployment, error) |
| 245 |
ApplyHydratedDeployment(context.Context, *telcoautomationpb.ApplyHydratedDeploymentRequest, ...gax.CallOption) (*telcoautomationpb.HydratedDeployment, error) |
| 246 |
GetLocation(context.Context, *locationpb.GetLocationRequest, ...gax.CallOption) (*locationpb.Location, error) |
| 247 |
ListLocations(context.Context, *locationpb.ListLocationsRequest, ...gax.CallOption) *LocationIterator |
| 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 |
|
| 260 |
|
| 261 |
|
| 262 |
type Client struct { |
| 263 |
|
| 264 |
internalClient internalClient |
| 265 |
|
| 266 |
|
| 267 |
CallOptions *CallOptions |
| 268 |
|
| 269 |
|
| 270 |
|
| 271 |
|
| 272 |
LROClient *lroauto.OperationsClient |
| 273 |
} |
| 274 |
|
| 275 |
|
| 276 |
|
| 277 |
|
| 278 |
|
| 279 |
func (c *Client) Close() error { |
| 280 |
return c.internalClient.Close() |
| 281 |
} |
| 282 |
|
| 283 |
|
| 284 |
|
| 285 |
|
| 286 |
func (c *Client) setGoogleClientInfo(keyval ...string) { |
| 287 |
c.internalClient.setGoogleClientInfo(keyval...) |
| 288 |
} |
| 289 |
|
| 290 |
|
| 291 |
|
| 292 |
|
| 293 |
|
| 294 |
func (c *Client) Connection() *grpc.ClientConn { |
| 295 |
return c.internalClient.Connection() |
| 296 |
} |
| 297 |
|
| 298 |
|
| 299 |
func (c *Client) ListOrchestrationClusters(ctx context.Context, req *telcoautomationpb.ListOrchestrationClustersRequest, opts ...gax.CallOption) *OrchestrationClusterIterator { |
| 300 |
return c.internalClient.ListOrchestrationClusters(ctx, req, opts...) |
| 301 |
} |
| 302 |
|
| 303 |
|
| 304 |
func (c *Client) GetOrchestrationCluster(ctx context.Context, req *telcoautomationpb.GetOrchestrationClusterRequest, opts ...gax.CallOption) (*telcoautomationpb.OrchestrationCluster, error) { |
| 305 |
return c.internalClient.GetOrchestrationCluster(ctx, req, opts...) |
| 306 |
} |
| 307 |
|
| 308 |
|
| 309 |
func (c *Client) CreateOrchestrationCluster(ctx context.Context, req *telcoautomationpb.CreateOrchestrationClusterRequest, opts ...gax.CallOption) (*CreateOrchestrationClusterOperation, error) { |
| 310 |
return c.internalClient.CreateOrchestrationCluster(ctx, req, opts...) |
| 311 |
} |
| 312 |
|
| 313 |
|
| 314 |
|
| 315 |
func (c *Client) CreateOrchestrationClusterOperation(name string) *CreateOrchestrationClusterOperation { |
| 316 |
return c.internalClient.CreateOrchestrationClusterOperation(name) |
| 317 |
} |
| 318 |
|
| 319 |
|
| 320 |
func (c *Client) DeleteOrchestrationCluster(ctx context.Context, req *telcoautomationpb.DeleteOrchestrationClusterRequest, opts ...gax.CallOption) (*DeleteOrchestrationClusterOperation, error) { |
| 321 |
return c.internalClient.DeleteOrchestrationCluster(ctx, req, opts...) |
| 322 |
} |
| 323 |
|
| 324 |
|
| 325 |
|
| 326 |
func (c *Client) DeleteOrchestrationClusterOperation(name string) *DeleteOrchestrationClusterOperation { |
| 327 |
return c.internalClient.DeleteOrchestrationClusterOperation(name) |
| 328 |
} |
| 329 |
|
| 330 |
|
| 331 |
func (c *Client) ListEdgeSlms(ctx context.Context, req *telcoautomationpb.ListEdgeSlmsRequest, opts ...gax.CallOption) *EdgeSlmIterator { |
| 332 |
return c.internalClient.ListEdgeSlms(ctx, req, opts...) |
| 333 |
} |
| 334 |
|
| 335 |
|
| 336 |
func (c *Client) GetEdgeSlm(ctx context.Context, req *telcoautomationpb.GetEdgeSlmRequest, opts ...gax.CallOption) (*telcoautomationpb.EdgeSlm, error) { |
| 337 |
return c.internalClient.GetEdgeSlm(ctx, req, opts...) |
| 338 |
} |
| 339 |
|
| 340 |
|
| 341 |
func (c *Client) CreateEdgeSlm(ctx context.Context, req *telcoautomationpb.CreateEdgeSlmRequest, opts ...gax.CallOption) (*CreateEdgeSlmOperation, error) { |
| 342 |
return c.internalClient.CreateEdgeSlm(ctx, req, opts...) |
| 343 |
} |
| 344 |
|
| 345 |
|
| 346 |
|
| 347 |
func (c *Client) CreateEdgeSlmOperation(name string) *CreateEdgeSlmOperation { |
| 348 |
return c.internalClient.CreateEdgeSlmOperation(name) |
| 349 |
} |
| 350 |
|
| 351 |
|
| 352 |
func (c *Client) DeleteEdgeSlm(ctx context.Context, req *telcoautomationpb.DeleteEdgeSlmRequest, opts ...gax.CallOption) (*DeleteEdgeSlmOperation, error) { |
| 353 |
return c.internalClient.DeleteEdgeSlm(ctx, req, opts...) |
| 354 |
} |
| 355 |
|
| 356 |
|
| 357 |
|
| 358 |
func (c *Client) DeleteEdgeSlmOperation(name string) *DeleteEdgeSlmOperation { |
| 359 |
return c.internalClient.DeleteEdgeSlmOperation(name) |
| 360 |
} |
| 361 |
|
| 362 |
|
| 363 |
func (c *Client) CreateBlueprint(ctx context.Context, req *telcoautomationpb.CreateBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 364 |
return c.internalClient.CreateBlueprint(ctx, req, opts...) |
| 365 |
} |
| 366 |
|
| 367 |
|
| 368 |
func (c *Client) UpdateBlueprint(ctx context.Context, req *telcoautomationpb.UpdateBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 369 |
return c.internalClient.UpdateBlueprint(ctx, req, opts...) |
| 370 |
} |
| 371 |
|
| 372 |
|
| 373 |
func (c *Client) GetBlueprint(ctx context.Context, req *telcoautomationpb.GetBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 374 |
return c.internalClient.GetBlueprint(ctx, req, opts...) |
| 375 |
} |
| 376 |
|
| 377 |
|
| 378 |
func (c *Client) DeleteBlueprint(ctx context.Context, req *telcoautomationpb.DeleteBlueprintRequest, opts ...gax.CallOption) error { |
| 379 |
return c.internalClient.DeleteBlueprint(ctx, req, opts...) |
| 380 |
} |
| 381 |
|
| 382 |
|
| 383 |
func (c *Client) ListBlueprints(ctx context.Context, req *telcoautomationpb.ListBlueprintsRequest, opts ...gax.CallOption) *BlueprintIterator { |
| 384 |
return c.internalClient.ListBlueprints(ctx, req, opts...) |
| 385 |
} |
| 386 |
|
| 387 |
|
| 388 |
func (c *Client) ApproveBlueprint(ctx context.Context, req *telcoautomationpb.ApproveBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 389 |
return c.internalClient.ApproveBlueprint(ctx, req, opts...) |
| 390 |
} |
| 391 |
|
| 392 |
|
| 393 |
func (c *Client) ProposeBlueprint(ctx context.Context, req *telcoautomationpb.ProposeBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 394 |
return c.internalClient.ProposeBlueprint(ctx, req, opts...) |
| 395 |
} |
| 396 |
|
| 397 |
|
| 398 |
func (c *Client) RejectBlueprint(ctx context.Context, req *telcoautomationpb.RejectBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 399 |
return c.internalClient.RejectBlueprint(ctx, req, opts...) |
| 400 |
} |
| 401 |
|
| 402 |
|
| 403 |
func (c *Client) ListBlueprintRevisions(ctx context.Context, req *telcoautomationpb.ListBlueprintRevisionsRequest, opts ...gax.CallOption) *BlueprintIterator { |
| 404 |
return c.internalClient.ListBlueprintRevisions(ctx, req, opts...) |
| 405 |
} |
| 406 |
|
| 407 |
|
| 408 |
func (c *Client) SearchBlueprintRevisions(ctx context.Context, req *telcoautomationpb.SearchBlueprintRevisionsRequest, opts ...gax.CallOption) *BlueprintIterator { |
| 409 |
return c.internalClient.SearchBlueprintRevisions(ctx, req, opts...) |
| 410 |
} |
| 411 |
|
| 412 |
|
| 413 |
func (c *Client) SearchDeploymentRevisions(ctx context.Context, req *telcoautomationpb.SearchDeploymentRevisionsRequest, opts ...gax.CallOption) *DeploymentIterator { |
| 414 |
return c.internalClient.SearchDeploymentRevisions(ctx, req, opts...) |
| 415 |
} |
| 416 |
|
| 417 |
|
| 418 |
|
| 419 |
|
| 420 |
func (c *Client) DiscardBlueprintChanges(ctx context.Context, req *telcoautomationpb.DiscardBlueprintChangesRequest, opts ...gax.CallOption) (*telcoautomationpb.DiscardBlueprintChangesResponse, error) { |
| 421 |
return c.internalClient.DiscardBlueprintChanges(ctx, req, opts...) |
| 422 |
} |
| 423 |
|
| 424 |
0, |
| 425 |
|
| 426 |
func (c *Client) ListPublicBlueprints(ctx context.Context, req *telcoautomationpb.ListPublicBlueprintsRequest, opts ...gax.CallOption) *PublicBlueprintIterator { |
| 427 |
return c.internalClient.ListPublicBlueprints(ctx, req, opts...) |
| 428 |
} |
| 429 |
|
| 430 |
|
| 431 |
func (c *Client) GetPublicBlueprint(ctx context.Context, req *telcoautomationpb.GetPublicBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.PublicBlueprint, error) { |
| 432 |
return c.internalClient.GetPublicBlueprint(ctx, req, opts...) |
| 433 |
} |
| 434 |
|
| 435 |
|
| 436 |
func (c *Client) CreateDeployment(ctx context.Context, req *telcoautomationpb.CreateDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 437 |
return c.internalClient.CreateDeployment(ctx, req, opts...) |
| 438 |
} |
| 439 |
|
| 440 |
|
| 441 |
func (c *Client) UpdateDeployment(ctx context.Context, req *telcoautomationpb.UpdateDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 442 |
return c.internalClient.UpdateDeployment(ctx, req, opts...) |
| 443 |
} |
| 444 |
|
| 445 |
|
| 446 |
func (c *Client) GetDeployment(ctx context.Context, req *telcoautomationpb.GetDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 447 |
return c.internalClient.GetDeployment(ctx, req, opts...) |
| 448 |
} |
| 449 |
|
| 450 |
|
| 451 |
d. |
| 452 |
func (c *Client) RemoveDeployment(ctx context.Context, req *telcoautomationpb.RemoveDeploymentRequest, opts ...gax.CallOption) error { |
| 453 |
return c.internalClient.RemoveDeployment(ctx, req, opts...) |
| 454 |
} |
| 455 |
|
| 456 |
|
| 457 |
func (c *Client) ListDeployments(ctx context.Context, req *telcoautomationpb.ListDeploymentsRequest, opts ...gax.CallOption) *DeploymentIterator { |
| 458 |
return c.internalClient.ListDeployments(ctx, req, opts...) |
| 459 |
} |
| 460 |
|
| 461 |
|
| 462 |
func (c *Client) ListDeploymentRevisions(ctx context.Context, req *telcoautomationpb.ListDeploymentRevisionsRequest, opts ...gax.CallOption) *DeploymentIterator { |
| 463 |
return c.internalClient.ListDeploymentRevisions(ctx, req, opts...) |
| 464 |
} |
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
func (c *Client) DiscardDeploymentChanges(ctx context.Context, req *telcoautomationpb.DiscardDeploymentChangesRequest, opts ...gax.CallOption) (*telcoautomationpb.DiscardDeploymentChangesResponse, error) { |
| 470 |
return c.internalClient.DiscardDeploymentChanges(ctx, req, opts...) |
| 471 |
} |
| 472 |
|
| 473 |
r. |
| 474 |
func (c *Client) ApplyDeployment(ctx context.Context, req *telcoautomationpb.ApplyDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 475 |
return c.internalClient.ApplyDeployment(ctx, req, opts...) |
| 476 |
} |
| 477 |
|
| 478 |
|
| 479 |
func (c *Client) ComputeDeploymentStatus(ctx context.Context, req *telcoautomationpb.ComputeDeploymentStatusRequest, opts ...gax.CallOption) (*telcoautomationpb.ComputeDeploymentStatusResponse, error) { |
| 480 |
return c.internalClient.ComputeDeploymentStatus(ctx, req, opts...) |
| 481 |
} |
| 482 |
|
| 483 |
|
| 484 |
|
| 485 |
func (c *Client) RollbackDeployment(ctx context.Context, req *telcoautomationpb.RollbackDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 486 |
return c.internalClient.RollbackDeployment(ctx, req, opts...) |
| 487 |
} |
| 488 |
|
| 489 |
|
| 490 |
func (c *Client) GetHydratedDeployment(ctx context.Context, req *telcoautomationpb.GetHydratedDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.HydratedDeployment, error) { |
| 491 |
return c.internalClient.GetHydratedDeployment(ctx, req, opts...) |
| 492 |
} |
| 493 |
|
| 494 |
|
| 495 |
func (c *Client) ListHydratedDeployments(ctx context.Context, req *telcoautomationpb.ListHydratedDeploymentsRequest, opts ...gax.CallOption) *HydratedDeploymentIterator { |
| 496 |
return c.internalClient.ListHydratedDeployments(ctx, req, opts...) |
| 497 |
} |
| 498 |
|
| 499 |
|
| 500 |
func (c *Client) UpdateHydratedDeployment(ctx context.Context, req *telcoautomationpb.UpdateHydratedDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.HydratedDeployment, error) { |
| 501 |
return c.internalClient.UpdateHydratedDeployment(ctx, req, opts...) |
| 502 |
} |
| 503 |
|
| 504 |
|
| 505 |
func (c *Client) ApplyHydratedDeployment(ctx context.Context, req *telcoautomationpb.ApplyHydratedDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.HydratedDeployment, error) { |
| 506 |
return c.internalClient.ApplyHydratedDeployment(ctx, req, opts...) |
| 507 |
} |
| 508 |
|
| 509 |
|
| 510 |
func (c *Client) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { |
| 511 |
return c.internalClient.GetLocation(ctx, req, opts...) |
| 512 |
} |
| 513 |
|
| 514 |
|
| 515 |
func (c *Client) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { |
| 516 |
return c.internalClient.ListLocations(ctx, req, opts...) |
| 517 |
} |
| 518 |
|
| 519 |
|
| 520 |
func (c *Client) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { |
| 521 |
return c.internalClient.CancelOperation(ctx, req, opts...) |
| 522 |
} |
| 523 |
|
| 524 |
|
| 525 |
func (c *Client) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { |
| 526 |
return c.internalClient.DeleteOperation(ctx, req, opts...) |
| 527 |
} |
| 528 |
|
| 529 |
|
| 530 |
func (c *Client) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { |
| 531 |
return c.internalClient.GetOperation(ctx, req, opts...) |
| 532 |
} |
| 533 |
|
| 534 |
|
| 535 |
func (c *Client) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { |
| 536 |
return c.internalClient.ListOperations(ctx, req, opts...) |
| 537 |
} |
| 538 |
|
| 539 |
|
| 540 |
|
| 541 |
|
| 542 |
type gRPCClient struct { |
| 543 |
|
| 544 |
connPool gtransport.ConnPool |
| 545 |
|
| 546 |
|
| 547 |
CallOptions **CallOptions |
| 548 |
|
| 549 |
|
| 550 |
client telcoautomationpb.TelcoAutomationClient |
| 551 |
|
| 552 |
|
| 553 |
|
| 554 |
|
| 555 |
LROClient **lroauto.OperationsClient |
| 556 |
|
| 557 |
operationsClient longrunningpb.OperationsClient |
| 558 |
|
| 559 |
locationsClient locationpb.LocationsClient |
| 560 |
|
| 561 |
|
| 562 |
xGoogHeaders []string |
| 563 |
|
| 564 |
logger *slog.Logger |
| 565 |
} |
| 566 |
|
| 567 |
|
| 568 |
|
| 569 |
|
| 570 |
|
| 571 |
|
| 572 |
|
| 573 |
|
| 574 |
|
| 575 |
func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { |
| 576 |
clientOpts := defaultGRPCClientOptions() |
| 577 |
if newClientHook != nil { |
| 578 |
hookOpts, err := newClientHook(ctx, clientHookParams{}) |
| 579 |
if err != nil { |
| 580 |
return nil, err |
| 581 |
} |
| 582 |
clientOpts = append(clientOpts, hookOpts...) |
| 583 |
} |
| 584 |
|
| 585 |
connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) |
| 586 |
if err != nil { |
| 587 |
return nil, err |
| 588 |
} |
| 589 |
client := Client{CallOptions: defaultCallOptions()} |
| 590 |
|
| 591 |
c := &gRPCClient{ |
| 592 |
connPool: connPool, |
| 593 |
client: telcoautomationpb.NewTelcoAutomationClient(connPool), |
| 594 |
CallOptions: &client.CallOptions, |
| 595 |
logger: internaloption.GetLogger(opts), |
| 596 |
operationsClient: longrunningpb.NewOperationsClient(connPool), |
| 597 |
locationsClient: locationpb.NewLocationsClient(connPool), |
| 598 |
} |
| 599 |
c.setGoogleClientInfo() |
| 600 |
|
| 601 |
client.internalClient = c |
| 602 |
|
| 603 |
client.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) |
| 604 |
if err != nil { |
| 605 |
|
| 606 |
|
| 607 |
|
| 608 |
|
| 609 |
|
| 610 |
|
| 611 |
return nil, err |
| 612 |
} |
| 613 |
c.LROClient = &client.LROClient |
| 614 |
return &client, nil |
| 615 |
} |
| 616 |
|
| 617 |
|
| 618 |
|
| 619 |
|
| 620 |
|
| 621 |
func (c *gRPCClient) Connection() *grpc.ClientConn { |
| 622 |
return c.connPool.Conn() |
| 623 |
} |
| 624 |
|
| 625 |
|
| 626 |
|
| 627 |
|
| 628 |
func (c *gRPCClient) setGoogleClientInfo(keyval ...string) { |
| 629 |
kv := append([]string{"gl-go", gax.GoVersion}, keyval...) |
| 630 |
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "grpc", grpc.Version, "pb", protoVersion) |
| 631 |
c.xGoogHeaders = []string{ |
| 632 |
"x-goog-api-client", gax.XGoogHeader(kv...), |
| 633 |
} |
| 634 |
} |
| 635 |
|
| 636 |
|
| 637 |
|
| 638 |
func (c *gRPCClient) Close() error { |
| 639 |
return c.connPool.Close() |
| 640 |
} |
| 641 |
|
| 642 |
|
| 643 |
type restClient struct { |
| 644 |
|
| 645 |
endpoint string |
| 646 |
|
| 647 |
|
| 648 |
httpClient *http.Client |
| 649 |
|
| 650 |
|
| 651 |
|
| 652 |
|
| 653 |
LROClient **lroauto.OperationsClient |
| 654 |
|
| 655 |
|
| 656 |
xGoogHeaders []string |
| 657 |
|
| 658 |
|
| 659 |
CallOptions **CallOptions |
| 660 |
|
| 661 |
logger *slog.Logger |
| 662 |
} |
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
|
| 669 |
|
| 670 |
|
| 671 |
func NewRESTClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { |
| 672 |
clientOpts := append(defaultRESTClientOptions(), opts...) |
| 673 |
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...) |
| 674 |
if err != nil { |
| 675 |
return nil, err |
| 676 |
} |
| 677 |
|
| 678 |
callOpts := defaultRESTCallOptions() |
| 679 |
c := &restClient{ |
| 680 |
endpoint: endpoint, |
| 681 |
httpClient: httpClient, |
| 682 |
CallOptions: &callOpts, |
| 683 |
logger: internaloption.GetLogger(opts), |
| 684 |
} |
| 685 |
c.setGoogleClientInfo() |
| 686 |
|
| 687 |
lroOpts := []option.ClientOption{ |
| 688 |
option.WithHTTPClient(httpClient), |
| 689 |
option.WithEndpoint(endpoint), |
| 690 |
} |
| 691 |
opClient, err := lroauto.NewOperationsRESTClient(ctx, lroOpts...) |
| 692 |
if err != nil { |
| 693 |
return nil, err |
| 694 |
} |
| 695 |
c.LROClient = &opClient |
| 696 |
|
| 697 |
return &Client{internalClient: c, CallOptions: callOpts}, nil |
| 698 |
} |
| 699 |
|
| 700 |
func defaultRESTClientOptions() []option.ClientOption { |
| 701 |
return []option.ClientOption{ |
| 702 |
internaloption.WithDefaultEndpoint("https://telcoautomation.googleapis.com"), |
| 703 |
internaloption.WithDefaultEndpointTemplate("https://telcoautomation.UNIVERSE_DOMAIN"), |
| 704 |
internaloption.WithDefaultMTLSEndpoint("https://telcoautomation.mtls.googleapis.com"), |
| 705 |
internaloption.WithDefaultUniverseDomain("googleapis.com"), |
| 706 |
internaloption.WithDefaultAudience("https://telcoautomation.googleapis.com/"), |
| 707 |
internaloption.WithDefaultScopes(DefaultAuthScopes()...), |
| 708 |
internaloption.EnableNewAuthLibrary(), |
| 709 |
} |
| 710 |
} |
| 711 |
|
| 712 |
|
| 713 |
|
| 714 |
|
| 715 |
func (c *restClient) setGoogleClientInfo(keyval ...string) { |
| 716 |
kv := append([]string{"gl-go", gax.GoVersion}, keyval...) |
| 717 |
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN", "pb", protoVersion) |
| 718 |
c.xGoogHeaders = []string{ |
| 719 |
"x-goog-api-client", gax.XGoogHeader(kv...), |
| 720 |
} |
| 721 |
} |
| 722 |
|
| 723 |
|
| 724 |
|
| 725 |
func (c *restClient) Close() error { |
| 726 |
|
| 727 |
c.httpClient = nil |
| 728 |
return nil |
| 729 |
} |
| 730 |
|
| 731 |
|
| 732 |
|
| 733 |
|
| 734 |
func (c *restClient) Connection() *grpc.ClientConn { |
| 735 |
return nil |
| 736 |
} |
| 737 |
func (c *gRPCClient) ListOrchestrationClusters(ctx context.Context, req *telcoautomationpb.ListOrchestrationClustersRequest, opts ...gax.CallOption) *OrchestrationClusterIterator { |
| 738 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 739 |
|
| 740 |
hds = append(c.xGoogHeaders, hds...) |
| 741 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 742 |
opts = append((*c.CallOptions).ListOrchestrationClusters[0:len((*c.CallOptions).ListOrchestrationClusters):len((*c.CallOptions).ListOrchestrationClusters)], opts...) |
| 743 |
it := &OrchestrationClusterIterator{} |
| 744 |
req = proto.Clone(req).(*telcoautomationpb.ListOrchestrationClustersRequest) |
| 745 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.OrchestrationCluster, string, error) { |
| 746 |
resp := &telcoautomationpb.ListOrchestrationClustersResponse{} |
| 747 |
if pageToken != "" { |
| 748 |
req.PageToken = pageToken |
| 749 |
} |
| 750 |
if pageSize > math.MaxInt32 { |
| 751 |
req.PageSize = math.MaxInt32 |
| 752 |
} else if pageSize != 0 { |
| 753 |
req.PageSize = int32(pageSize) |
| 754 |
} |
| 755 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 756 |
var err error |
| 757 |
resp, err = executeRPC(ctx, c.client.ListOrchestrationClusters, req, settings.GRPC, c.logger, "ListOrchestrationClusters") |
| 758 |
return err |
| 759 |
}, opts...) |
| 760 |
if err != nil { |
| 761 |
return nil, "", err |
| 762 |
} |
| 763 |
|
| 764 |
it.Response = resp |
| 765 |
return resp.GetOrchestrationClusters(), resp.GetNextPageToken(), nil |
| 766 |
} |
| 767 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 768 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 769 |
if err != nil { |
| 770 |
return "", err |
| 771 |
} |
| 772 |
it.items = append(it.items, items...) |
| 773 |
return nextPageToken, nil |
| 774 |
} |
| 775 |
|
| 776 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 777 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 778 |
it.pageInfo.Token = req.GetPageToken() |
| 779 |
|
| 780 |
return it |
| 781 |
} |
| 782 |
|
| 783 |
func (c *gRPCClient) GetOrchestrationCluster(ctx context.Context, req *telcoautomationpb.GetOrchestrationClusterRequest, opts ...gax.CallOption) (*telcoautomationpb.OrchestrationCluster, error) { |
| 784 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 785 |
|
| 786 |
hds = append(c.xGoogHeaders, hds...) |
| 787 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 788 |
opts = append((*c.CallOptions).GetOrchestrationCluster[0:len((*c.CallOptions).GetOrchestrationCluster):len((*c.CallOptions).GetOrchestrationCluster)], opts...) |
| 789 |
var resp *telcoautomationpb.OrchestrationCluster |
| 790 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 791 |
var err error |
| 792 |
resp, err = executeRPC(ctx, c.client.GetOrchestrationCluster, req, settings.GRPC, c.logger, "GetOrchestrationCluster") |
| 793 |
return err |
| 794 |
}, opts...) |
| 795 |
if err != nil { |
| 796 |
return nil, err |
| 797 |
} |
| 798 |
return resp, nil |
| 799 |
} |
| 800 |
|
| 801 |
func (c *gRPCClient) CreateOrchestrationCluster(ctx context.Context, req *telcoautomationpb.CreateOrchestrationClusterRequest, opts ...gax.CallOption) (*CreateOrchestrationClusterOperation, error) { |
| 802 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 803 |
|
| 804 |
hds = append(c.xGoogHeaders, hds...) |
| 805 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 806 |
opts = append((*c.CallOptions).CreateOrchestrationCluster[0:len((*c.CallOptions).CreateOrchestrationCluster):len((*c.CallOptions).CreateOrchestrationCluster)], opts...) |
| 807 |
var resp *longrunningpb.Operation |
| 808 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 809 |
var err error |
| 810 |
resp, err = executeRPC(ctx, c.client.CreateOrchestrationCluster, req, settings.GRPC, c.logger, "CreateOrchestrationCluster") |
| 811 |
return err |
| 812 |
}, opts...) |
| 813 |
if err != nil { |
| 814 |
return nil, err |
| 815 |
} |
| 816 |
return &CreateOrchestrationClusterOperation{ |
| 817 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 818 |
}, nil |
| 819 |
} |
| 820 |
|
| 821 |
func (c *gRPCClient) DeleteOrchestrationCluster(ctx context.Context, req *telcoautomationpb.DeleteOrchestrationClusterRequest, opts ...gax.CallOption) (*DeleteOrchestrationClusterOperation, error) { |
| 822 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 823 |
|
| 824 |
hds = append(c.xGoogHeaders, hds...) |
| 825 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 826 |
opts = append((*c.CallOptions).DeleteOrchestrationCluster[0:len((*c.CallOptions).DeleteOrchestrationCluster):len((*c.CallOptions).DeleteOrchestrationCluster)], opts...) |
| 827 |
var resp *longrunningpb.Operation |
| 828 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 829 |
var err error |
| 830 |
resp, err = executeRPC(ctx, c.client.DeleteOrchestrationCluster, req, settings.GRPC, c.logger, "DeleteOrchestrationCluster") |
| 831 |
return err |
| 832 |
}, opts...) |
| 833 |
if err != nil { |
| 834 |
return nil, err |
| 835 |
} |
| 836 |
return &DeleteOrchestrationClusterOperation{ |
| 837 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 838 |
}, nil |
| 839 |
} |
| 840 |
|
| 841 |
func (c *gRPCClient) ListEdgeSlms(ctx context.Context, req *telcoautomationpb.ListEdgeSlmsRequest, opts ...gax.CallOption) *EdgeSlmIterator { |
| 842 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 843 |
|
| 844 |
hds = append(c.xGoogHeaders, hds...) |
| 845 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 846 |
opts = append((*c.CallOptions).ListEdgeSlms[0:len((*c.CallOptions).ListEdgeSlms):len((*c.CallOptions).ListEdgeSlms)], opts...) |
| 847 |
it := &EdgeSlmIterator{} |
| 848 |
req = proto.Clone(req).(*telcoautomationpb.ListEdgeSlmsRequest) |
| 849 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.EdgeSlm, string, error) { |
| 850 |
resp := &telcoautomationpb.ListEdgeSlmsResponse{} |
| 851 |
if pageToken != "" { |
| 852 |
req.PageToken = pageToken |
| 853 |
} |
| 854 |
if pageSize > math.MaxInt32 { |
| 855 |
req.PageSize = math.MaxInt32 |
| 856 |
} else if pageSize != 0 { |
| 857 |
req.PageSize = int32(pageSize) |
| 858 |
} |
| 859 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 860 |
var err error |
| 861 |
resp, err = executeRPC(ctx, c.client.ListEdgeSlms, req, settings.GRPC, c.logger, "ListEdgeSlms") |
| 862 |
return err |
| 863 |
}, opts...) |
| 864 |
if err != nil { |
| 865 |
return nil, "", err |
| 866 |
} |
| 867 |
|
| 868 |
it.Response = resp |
| 869 |
return resp.GetEdgeSlms(), resp.GetNextPageToken(), nil |
| 870 |
} |
| 871 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 872 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 873 |
if err != nil { |
| 874 |
return "", err |
| 875 |
} |
| 876 |
it.items = append(it.items, items...) |
| 877 |
return nextPageToken, nil |
| 878 |
} |
| 879 |
|
| 880 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 881 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 882 |
it.pageInfo.Token = req.GetPageToken() |
| 883 |
|
| 884 |
return it |
| 885 |
} |
| 886 |
|
| 887 |
func (c *gRPCClient) GetEdgeSlm(ctx context.Context, req *telcoautomationpb.GetEdgeSlmRequest, opts ...gax.CallOption) (*telcoautomationpb.EdgeSlm, error) { |
| 888 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 889 |
|
| 890 |
hds = append(c.xGoogHeaders, hds...) |
| 891 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 892 |
opts = append((*c.CallOptions).GetEdgeSlm[0:len((*c.CallOptions).GetEdgeSlm):len((*c.CallOptions).GetEdgeSlm)], opts...) |
| 893 |
var resp *telcoautomationpb.EdgeSlm |
| 894 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 895 |
var err error |
| 896 |
resp, err = executeRPC(ctx, c.client.GetEdgeSlm, req, settings.GRPC, c.logger, "GetEdgeSlm") |
| 897 |
return err |
| 898 |
}, opts...) |
| 899 |
if err != nil { |
| 900 |
return nil, err |
| 901 |
} |
| 902 |
return resp, nil |
| 903 |
} |
| 904 |
|
| 905 |
func (c *gRPCClient) CreateEdgeSlm(ctx context.Context, req *telcoautomationpb.CreateEdgeSlmRequest, opts ...gax.CallOption) (*CreateEdgeSlmOperation, error) { |
| 906 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 907 |
|
| 908 |
hds = append(c.xGoogHeaders, hds...) |
| 909 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 910 |
opts = append((*c.CallOptions).CreateEdgeSlm[0:len((*c.CallOptions).CreateEdgeSlm):len((*c.CallOptions).CreateEdgeSlm)], opts...) |
| 911 |
var resp *longrunningpb.Operation |
| 912 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 913 |
var err error |
| 914 |
resp, err = executeRPC(ctx, c.client.CreateEdgeSlm, req, settings.GRPC, c.logger, "CreateEdgeSlm") |
| 915 |
return err |
| 916 |
}, opts...) |
| 917 |
if err != nil { |
| 918 |
return nil, err |
| 919 |
} |
| 920 |
return &CreateEdgeSlmOperation{ |
| 921 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 922 |
}, nil |
| 923 |
} |
| 924 |
|
| 925 |
func (c *gRPCClient) DeleteEdgeSlm(ctx context.Context, req *telcoautomationpb.DeleteEdgeSlmRequest, opts ...gax.CallOption) (*DeleteEdgeSlmOperation, error) { |
| 926 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 927 |
|
| 928 |
hds = append(c.xGoogHeaders, hds...) |
| 929 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 930 |
opts = append((*c.CallOptions).DeleteEdgeSlm[0:len((*c.CallOptions).DeleteEdgeSlm):len((*c.CallOptions).DeleteEdgeSlm)], opts...) |
| 931 |
var resp *longrunningpb.Operation |
| 932 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 933 |
var err error |
| 934 |
resp, err = executeRPC(ctx, c.client.DeleteEdgeSlm, req, settings.GRPC, c.logger, "DeleteEdgeSlm") |
| 935 |
return err |
| 936 |
}, opts...) |
| 937 |
if err != nil { |
| 938 |
return nil, err |
| 939 |
} |
| 940 |
return &DeleteEdgeSlmOperation{ |
| 941 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 942 |
}, nil |
| 943 |
} |
| 944 |
|
| 945 |
func (c *gRPCClient) CreateBlueprint(ctx context.Context, req *telcoautomationpb.CreateBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 946 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 947 |
|
| 948 |
hds = append(c.xGoogHeaders, hds...) |
| 949 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 950 |
opts = append((*c.CallOptions).CreateBlueprint[0:len((*c.CallOptions).CreateBlueprint):len((*c.CallOptions).CreateBlueprint)], opts...) |
| 951 |
var resp *telcoautomationpb.Blueprint |
| 952 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 953 |
var err error |
| 954 |
resp, err = executeRPC(ctx, c.client.CreateBlueprint, req, settings.GRPC, c.logger, "CreateBlueprint") |
| 955 |
return err |
| 956 |
}, opts...) |
| 957 |
if err != nil { |
| 958 |
return nil, err |
| 959 |
} |
| 960 |
return resp, nil |
| 961 |
} |
| 962 |
|
| 963 |
func (c *gRPCClient) UpdateBlueprint(ctx context.Context, req *telcoautomationpb.UpdateBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 964 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "blueprint.name", url.QueryEscape(req.GetBlueprint().GetName()))} |
| 965 |
|
| 966 |
hds = append(c.xGoogHeaders, hds...) |
| 967 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 968 |
opts = append((*c.CallOptions).UpdateBlueprint[0:len((*c.CallOptions).UpdateBlueprint):len((*c.CallOptions).UpdateBlueprint)], opts...) |
| 969 |
var resp *telcoautomationpb.Blueprint |
| 970 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 971 |
var err error |
| 972 |
resp, err = executeRPC(ctx, c.client.UpdateBlueprint, req, settings.GRPC, c.logger, "UpdateBlueprint") |
| 973 |
return err |
| 974 |
}, opts...) |
| 975 |
if err != nil { |
| 976 |
return nil, err |
| 977 |
} |
| 978 |
return resp, nil |
| 979 |
} |
| 980 |
|
| 981 |
func (c *gRPCClient) GetBlueprint(ctx context.Context, req *telcoautomationpb.GetBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 982 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 983 |
|
| 984 |
hds = append(c.xGoogHeaders, hds...) |
| 985 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 986 |
opts = append((*c.CallOptions).GetBlueprint[0:len((*c.CallOptions).GetBlueprint):len((*c.CallOptions).GetBlueprint)], opts...) |
| 987 |
var resp *telcoautomationpb.Blueprint |
| 988 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 989 |
var err error |
| 990 |
resp, err = executeRPC(ctx, c.client.GetBlueprint, req, settings.GRPC, c.logger, "GetBlueprint") |
| 991 |
return err |
| 992 |
}, opts...) |
| 993 |
if err != nil { |
| 994 |
return nil, err |
| 995 |
} |
| 996 |
return resp, nil |
| 997 |
} |
| 998 |
|
| 999 |
func (c *gRPCClient) DeleteBlueprint(ctx context.Context, req *telcoautomationpb.DeleteBlueprintRequest, opts ...gax.CallOption) error { |
| 1000 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1001 |
|
| 1002 |
hds = append(c.xGoogHeaders, hds...) |
| 1003 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1004 |
opts = append((*c.CallOptions).DeleteBlueprint[0:len((*c.CallOptions).DeleteBlueprint):len((*c.CallOptions).DeleteBlueprint)], opts...) |
| 1005 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1006 |
var err error |
| 1007 |
_, err = executeRPC(ctx, c.client.DeleteBlueprint, req, settings.GRPC, c.logger, "DeleteBlueprint") |
| 1008 |
return err |
| 1009 |
}, opts...) |
| 1010 |
return err |
| 1011 |
} |
| 1012 |
|
| 1013 |
func (c *gRPCClient) ListBlueprints(ctx context.Context, req *telcoautomationpb.ListBlueprintsRequest, opts ...gax.CallOption) *BlueprintIterator { |
| 1014 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1015 |
|
| 1016 |
hds = append(c.xGoogHeaders, hds...) |
| 1017 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1018 |
opts = append((*c.CallOptions).ListBlueprints[0:len((*c.CallOptions).ListBlueprints):len((*c.CallOptions).ListBlueprints)], opts...) |
| 1019 |
it := &BlueprintIterator{} |
| 1020 |
req = proto.Clone(req).(*telcoautomationpb.ListBlueprintsRequest) |
| 1021 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.Blueprint, string, error) { |
| 1022 |
resp := &telcoautomationpb.ListBlueprintsResponse{} |
| 1023 |
if pageToken != "" { |
| 1024 |
req.PageToken = pageToken |
| 1025 |
} |
| 1026 |
if pageSize > math.MaxInt32 { |
| 1027 |
req.PageSize = math.MaxInt32 |
| 1028 |
} else if pageSize != 0 { |
| 1029 |
req.PageSize = int32(pageSize) |
| 1030 |
} |
| 1031 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1032 |
var err error |
| 1033 |
resp, err = executeRPC(ctx, c.client.ListBlueprints, req, settings.GRPC, c.logger, "ListBlueprints") |
| 1034 |
return err |
| 1035 |
}, opts...) |
| 1036 |
if err != nil { |
| 1037 |
return nil, "", err |
| 1038 |
} |
| 1039 |
|
| 1040 |
it.Response = resp |
| 1041 |
return resp.GetBlueprints(), resp.GetNextPageToken(), nil |
| 1042 |
} |
| 1043 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1044 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1045 |
if err != nil { |
| 1046 |
return "", err |
| 1047 |
} |
| 1048 |
it.items = append(it.items, items...) |
| 1049 |
return nextPageToken, nil |
| 1050 |
} |
| 1051 |
|
| 1052 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1053 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1054 |
it.pageInfo.Token = req.GetPageToken() |
| 1055 |
|
| 1056 |
return it |
| 1057 |
} |
| 1058 |
|
| 1059 |
func (c *gRPCClient) ApproveBlueprint(ctx context.Context, req *telcoautomationpb.ApproveBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 1060 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1061 |
|
| 1062 |
hds = append(c.xGoogHeaders, hds...) |
| 1063 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1064 |
opts = append((*c.CallOptions).ApproveBlueprint[0:len((*c.CallOptions).ApproveBlueprint):len((*c.CallOptions).ApproveBlueprint)], opts...) |
| 1065 |
var resp *telcoautomationpb.Blueprint |
| 1066 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1067 |
var err error |
| 1068 |
resp, err = executeRPC(ctx, c.client.ApproveBlueprint, req, settings.GRPC, c.logger, "ApproveBlueprint") |
| 1069 |
return err |
| 1070 |
}, opts...) |
| 1071 |
if err != nil { |
| 1072 |
return nil, err |
| 1073 |
} |
| 1074 |
return resp, nil |
| 1075 |
} |
| 1076 |
|
| 1077 |
func (c *gRPCClient) ProposeBlueprint(ctx context.Context, req *telcoautomationpb.ProposeBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 1078 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1079 |
|
| 1080 |
hds = append(c.xGoogHeaders, hds...) |
| 1081 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1082 |
opts = append((*c.CallOptions).ProposeBlueprint[0:len((*c.CallOptions).ProposeBlueprint):len((*c.CallOptions).ProposeBlueprint)], opts...) |
| 1083 |
var resp *telcoautomationpb.Blueprint |
| 1084 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1085 |
var err error |
| 1086 |
resp, err = executeRPC(ctx, c.client.ProposeBlueprint, req, settings.GRPC, c.logger, "ProposeBlueprint") |
| 1087 |
return err |
| 1088 |
}, opts...) |
| 1089 |
if err != nil { |
| 1090 |
return nil, err |
| 1091 |
} |
| 1092 |
return resp, nil |
| 1093 |
} |
| 1094 |
|
| 1095 |
func (c *gRPCClient) RejectBlueprint(ctx context.Context, req *telcoautomationpb.RejectBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 1096 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1097 |
|
| 1098 |
hds = append(c.xGoogHeaders, hds...) |
| 1099 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1100 |
opts = append((*c.CallOptions).RejectBlueprint[0:len((*c.CallOptions).RejectBlueprint):len((*c.CallOptions).RejectBlueprint)], opts...) |
| 1101 |
var resp *telcoautomationpb.Blueprint |
| 1102 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1103 |
var err error |
| 1104 |
resp, err = executeRPC(ctx, c.client.RejectBlueprint, req, settings.GRPC, c.logger, "RejectBlueprint") |
| 1105 |
return err |
| 1106 |
}, opts...) |
| 1107 |
if err != nil { |
| 1108 |
return nil, err |
| 1109 |
} |
| 1110 |
return resp, nil |
| 1111 |
} |
| 1112 |
|
| 1113 |
func (c *gRPCClient) ListBlueprintRevisions(ctx context.Context, req *telcoautomationpb.ListBlueprintRevisionsRequest, opts ...gax.CallOption) *BlueprintIterator { |
| 1114 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1115 |
|
| 1116 |
hds = append(c.xGoogHeaders, hds...) |
| 1117 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1118 |
opts = append((*c.CallOptions).ListBlueprintRevisions[0:len((*c.CallOptions).ListBlueprintRevisions):len((*c.CallOptions).ListBlueprintRevisions)], opts...) |
| 1119 |
it := &BlueprintIterator{} |
| 1120 |
req = proto.Clone(req).(*telcoautomationpb.ListBlueprintRevisionsRequest) |
| 1121 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.Blueprint, string, error) { |
| 1122 |
resp := &telcoautomationpb.ListBlueprintRevisionsResponse{} |
| 1123 |
if pageToken != "" { |
| 1124 |
req.PageToken = pageToken |
| 1125 |
} |
| 1126 |
if pageSize > math.MaxInt32 { |
| 1127 |
req.PageSize = math.MaxInt32 |
| 1128 |
} else if pageSize != 0 { |
| 1129 |
req.PageSize = int32(pageSize) |
| 1130 |
} |
| 1131 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1132 |
var err error |
| 1133 |
resp, err = executeRPC(ctx, c.client.ListBlueprintRevisions, req, settings.GRPC, c.logger, "ListBlueprintRevisions") |
| 1134 |
return err |
| 1135 |
}, opts...) |
| 1136 |
if err != nil { |
| 1137 |
return nil, "", err |
| 1138 |
} |
| 1139 |
|
| 1140 |
it.Response = resp |
| 1141 |
return resp.GetBlueprints(), resp.GetNextPageToken(), nil |
| 1142 |
} |
| 1143 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1144 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1145 |
if err != nil { |
| 1146 |
return "", err |
| 1147 |
} |
| 1148 |
it.items = append(it.items, items...) |
| 1149 |
return nextPageToken, nil |
| 1150 |
} |
| 1151 |
|
| 1152 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1153 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1154 |
it.pageInfo.Token = req.GetPageToken() |
| 1155 |
|
| 1156 |
return it |
| 1157 |
} |
| 1158 |
|
| 1159 |
func (c *gRPCClient) SearchBlueprintRevisions(ctx context.Context, req *telcoautomationpb.SearchBlueprintRevisionsRequest, opts ...gax.CallOption) *BlueprintIterator { |
| 1160 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1161 |
|
| 1162 |
hds = append(c.xGoogHeaders, hds...) |
| 1163 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1164 |
opts = append((*c.CallOptions).SearchBlueprintRevisions[0:len((*c.CallOptions).SearchBlueprintRevisions):len((*c.CallOptions).SearchBlueprintRevisions)], opts...) |
| 1165 |
it := &BlueprintIterator{} |
| 1166 |
req = proto.Clone(req).(*telcoautomationpb.SearchBlueprintRevisionsRequest) |
| 1167 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.Blueprint, string, error) { |
| 1168 |
resp := &telcoautomationpb.SearchBlueprintRevisionsResponse{} |
| 1169 |
if pageToken != "" { |
| 1170 |
req.PageToken = pageToken |
| 1171 |
} |
| 1172 |
if pageSize > math.MaxInt32 { |
| 1173 |
req.PageSize = math.MaxInt32 |
| 1174 |
} else if pageSize != 0 { |
| 1175 |
req.PageSize = int32(pageSize) |
| 1176 |
} |
| 1177 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1178 |
var err error |
| 1179 |
resp, err = executeRPC(ctx, c.client.SearchBlueprintRevisions, req, settings.GRPC, c.logger, "SearchBlueprintRevisions") |
| 1180 |
return err |
| 1181 |
}, opts...) |
| 1182 |
if err != nil { |
| 1183 |
return nil, "", err |
| 1184 |
} |
| 1185 |
|
| 1186 |
it.Response = resp |
| 1187 |
return resp.GetBlueprints(), resp.GetNextPageToken(), nil |
| 1188 |
} |
| 1189 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1190 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1191 |
if err != nil { |
| 1192 |
return "", err |
| 1193 |
} |
| 1194 |
it.items = append(it.items, items...) |
| 1195 |
return nextPageToken, nil |
| 1196 |
} |
| 1197 |
|
| 1198 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1199 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1200 |
it.pageInfo.Token = req.GetPageToken() |
| 1201 |
|
| 1202 |
return it |
| 1203 |
} |
| 1204 |
|
| 1205 |
func (c *gRPCClient) SearchDeploymentRevisions(ctx context.Context, req *telcoautomationpb.SearchDeploymentRevisionsRequest, opts ...gax.CallOption) *DeploymentIterator { |
| 1206 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1207 |
|
| 1208 |
hds = append(c.xGoogHeaders, hds...) |
| 1209 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1210 |
opts = append((*c.CallOptions).SearchDeploymentRevisions[0:len((*c.CallOptions).SearchDeploymentRevisions):len((*c.CallOptions).SearchDeploymentRevisions)], opts...) |
| 1211 |
it := &DeploymentIterator{} |
| 1212 |
req = proto.Clone(req).(*telcoautomationpb.SearchDeploymentRevisionsRequest) |
| 1213 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.Deployment, string, error) { |
| 1214 |
resp := &telcoautomationpb.SearchDeploymentRevisionsResponse{} |
| 1215 |
if pageToken != "" { |
| 1216 |
req.PageToken = pageToken |
| 1217 |
} |
| 1218 |
if pageSize > math.MaxInt32 { |
| 1219 |
req.PageSize = math.MaxInt32 |
| 1220 |
} else if pageSize != 0 { |
| 1221 |
req.PageSize = int32(pageSize) |
| 1222 |
} |
| 1223 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1224 |
var err error |
| 1225 |
resp, err = executeRPC(ctx, c.client.SearchDeploymentRevisions, req, settings.GRPC, c.logger, "SearchDeploymentRevisions") |
| 1226 |
return err |
| 1227 |
}, opts...) |
| 1228 |
if err != nil { |
| 1229 |
return nil, "", err |
| 1230 |
} |
| 1231 |
|
| 1232 |
it.Response = resp |
| 1233 |
return resp.GetDeployments(), resp.GetNextPageToken(), nil |
| 1234 |
} |
| 1235 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1236 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1237 |
if err != nil { |
| 1238 |
return "", err |
| 1239 |
} |
| 1240 |
it.items = append(it.items, items...) |
| 1241 |
return nextPageToken, nil |
| 1242 |
} |
| 1243 |
|
| 1244 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1245 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1246 |
it.pageInfo.Token = req.GetPageToken() |
| 1247 |
|
| 1248 |
return it |
| 1249 |
} |
| 1250 |
|
| 1251 |
func (c *gRPCClient) DiscardBlueprintChanges(ctx context.Context, req *telcoautomationpb.DiscardBlueprintChangesRequest, opts ...gax.CallOption) (*telcoautomationpb.DiscardBlueprintChangesResponse, error) { |
| 1252 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1253 |
|
| 1254 |
hds = append(c.xGoogHeaders, hds...) |
| 1255 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1256 |
opts = append((*c.CallOptions).DiscardBlueprintChanges[0:len((*c.CallOptions).DiscardBlueprintChanges):len((*c.CallOptions).DiscardBlueprintChanges)], opts...) |
| 1257 |
var resp *telcoautomationpb.DiscardBlueprintChangesResponse |
| 1258 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1259 |
var err error |
| 1260 |
resp, err = executeRPC(ctx, c.client.DiscardBlueprintChanges, req, settings.GRPC, c.logger, "DiscardBlueprintChanges") |
| 1261 |
return err |
| 1262 |
}, opts...) |
| 1263 |
if err != nil { |
| 1264 |
return nil, err |
| 1265 |
} |
| 1266 |
return resp, nil |
| 1267 |
} |
| 1268 |
|
| 1269 |
func (c *gRPCClient) ListPublicBlueprints(ctx context.Context, req *telcoautomationpb.ListPublicBlueprintsRequest, opts ...gax.CallOption) *PublicBlueprintIterator { |
| 1270 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1271 |
|
| 1272 |
hds = append(c.xGoogHeaders, hds...) |
| 1273 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1274 |
opts = append((*c.CallOptions).ListPublicBlueprints[0:len((*c.CallOptions).ListPublicBlueprints):len((*c.CallOptions).ListPublicBlueprints)], opts...) |
| 1275 |
it := &PublicBlueprintIterator{} |
| 1276 |
req = proto.Clone(req).(*telcoautomationpb.ListPublicBlueprintsRequest) |
| 1277 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.PublicBlueprint, string, error) { |
| 1278 |
resp := &telcoautomationpb.ListPublicBlueprintsResponse{} |
| 1279 |
if pageToken != "" { |
| 1280 |
req.PageToken = pageToken |
| 1281 |
} |
| 1282 |
if pageSize > math.MaxInt32 { |
| 1283 |
req.PageSize = math.MaxInt32 |
| 1284 |
} else if pageSize != 0 { |
| 1285 |
req.PageSize = int32(pageSize) |
| 1286 |
} |
| 1287 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1288 |
var err error |
| 1289 |
resp, err = executeRPC(ctx, c.client.ListPublicBlueprints, req, settings.GRPC, c.logger, "ListPublicBlueprints") |
| 1290 |
return err |
| 1291 |
}, opts...) |
| 1292 |
if err != nil { |
| 1293 |
return nil, "", err |
| 1294 |
} |
| 1295 |
|
| 1296 |
it.Response = resp |
| 1297 |
return resp.GetPublicBlueprints(), resp.GetNextPageToken(), nil |
| 1298 |
} |
| 1299 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1300 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1301 |
if err != nil { |
| 1302 |
return "", err |
| 1303 |
} |
| 1304 |
it.items = append(it.items, items...) |
| 1305 |
return nextPageToken, nil |
| 1306 |
} |
| 1307 |
|
| 1308 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1309 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1310 |
it.pageInfo.Token = req.GetPageToken() |
| 1311 |
|
| 1312 |
return it |
| 1313 |
} |
| 1314 |
|
| 1315 |
func (c *gRPCClient) GetPublicBlueprint(ctx context.Context, req *telcoautomationpb.GetPublicBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.PublicBlueprint, error) { |
| 1316 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1317 |
|
| 1318 |
hds = append(c.xGoogHeaders, hds...) |
| 1319 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1320 |
opts = append((*c.CallOptions).GetPublicBlueprint[0:len((*c.CallOptions).GetPublicBlueprint):len((*c.CallOptions).GetPublicBlueprint)], opts...) |
| 1321 |
var resp *telcoautomationpb.PublicBlueprint |
| 1322 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1323 |
var err error |
| 1324 |
resp, err = executeRPC(ctx, c.client.GetPublicBlueprint, req, settings.GRPC, c.logger, "GetPublicBlueprint") |
| 1325 |
return err |
| 1326 |
}, opts...) |
| 1327 |
if err != nil { |
| 1328 |
return nil, err |
| 1329 |
} |
| 1330 |
return resp, nil |
| 1331 |
} |
| 1332 |
|
| 1333 |
func (c *gRPCClient) CreateDeployment(ctx context.Context, req *telcoautomationpb.CreateDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 1334 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1335 |
|
| 1336 |
hds = append(c.xGoogHeaders, hds...) |
| 1337 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1338 |
opts = append((*c.CallOptions).CreateDeployment[0:len((*c.CallOptions).CreateDeployment):len((*c.CallOptions).CreateDeployment)], opts...) |
| 1339 |
var resp *telcoautomationpb.Deployment |
| 1340 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1341 |
var err error |
| 1342 |
resp, err = executeRPC(ctx, c.client.CreateDeployment, req, settings.GRPC, c.logger, "CreateDeployment") |
| 1343 |
return err |
| 1344 |
}, opts...) |
| 1345 |
if err != nil { |
| 1346 |
return nil, err |
| 1347 |
} |
| 1348 |
return resp, nil |
| 1349 |
} |
| 1350 |
|
| 1351 |
func (c *gRPCClient) UpdateDeployment(ctx context.Context, req *telcoautomationpb.UpdateDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 1352 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "deployment.name", url.QueryEscape(req.GetDeployment().GetName()))} |
| 1353 |
|
| 1354 |
hds = append(c.xGoogHeaders, hds...) |
| 1355 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1356 |
opts = append((*c.CallOptions).UpdateDeployment[0:len((*c.CallOptions).UpdateDeployment):len((*c.CallOptions).UpdateDeployment)], opts...) |
| 1357 |
var resp *telcoautomationpb.Deployment |
| 1358 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1359 |
var err error |
| 1360 |
resp, err = executeRPC(ctx, c.client.UpdateDeployment, req, settings.GRPC, c.logger, "UpdateDeployment") |
| 1361 |
return err |
| 1362 |
}, opts...) |
| 1363 |
if err != nil { |
| 1364 |
return nil, err |
| 1365 |
} |
| 1366 |
return resp, nil |
| 1367 |
} |
| 1368 |
|
| 1369 |
func (c *gRPCClient) GetDeployment(ctx context.Context, req *telcoautomationpb.GetDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 1370 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1371 |
|
| 1372 |
hds = append(c.xGoogHeaders, hds...) |
| 1373 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1374 |
opts = append((*c.CallOptions).GetDeployment[0:len((*c.CallOptions).GetDeployment):len((*c.CallOptions).GetDeployment)], opts...) |
| 1375 |
var resp *telcoautomationpb.Deployment |
| 1376 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1377 |
var err error |
| 1378 |
resp, err = executeRPC(ctx, c.client.GetDeployment, req, settings.GRPC, c.logger, "GetDeployment") |
| 1379 |
return err |
| 1380 |
}, opts...) |
| 1381 |
if err != nil { |
| 1382 |
return nil, err |
| 1383 |
} |
| 1384 |
return resp, nil |
| 1385 |
} |
| 1386 |
|
| 1387 |
func (c *gRPCClient) RemoveDeployment(ctx context.Context, req *telcoautomationpb.RemoveDeploymentRequest, opts ...gax.CallOption) error { |
| 1388 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1389 |
|
| 1390 |
hds = append(c.xGoogHeaders, hds...) |
| 1391 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1392 |
opts = append((*c.CallOptions).RemoveDeployment[0:len((*c.CallOptions).RemoveDeployment):len((*c.CallOptions).RemoveDeployment)], opts...) |
| 1393 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1394 |
var err error |
| 1395 |
_, err = executeRPC(ctx, c.client.RemoveDeployment, req, settings.GRPC, c.logger, "RemoveDeployment") |
| 1396 |
return err |
| 1397 |
}, opts...) |
| 1398 |
return err |
| 1399 |
} |
| 1400 |
|
| 1401 |
func (c *gRPCClient) ListDeployments(ctx context.Context, req *telcoautomationpb.ListDeploymentsRequest, opts ...gax.CallOption) *DeploymentIterator { |
| 1402 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1403 |
|
| 1404 |
hds = append(c.xGoogHeaders, hds...) |
| 1405 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1406 |
opts = append((*c.CallOptions).ListDeployments[0:len((*c.CallOptions).ListDeployments):len((*c.CallOptions).ListDeployments)], opts...) |
| 1407 |
it := &DeploymentIterator{} |
| 1408 |
req = proto.Clone(req).(*telcoautomationpb.ListDeploymentsRequest) |
| 1409 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.Deployment, string, error) { |
| 1410 |
resp := &telcoautomationpb.ListDeploymentsResponse{} |
| 1411 |
if pageToken != "" { |
| 1412 |
req.PageToken = pageToken |
| 1413 |
} |
| 1414 |
if pageSize > math.MaxInt32 { |
| 1415 |
req.PageSize = math.MaxInt32 |
| 1416 |
} else if pageSize != 0 { |
| 1417 |
req.PageSize = int32(pageSize) |
| 1418 |
} |
| 1419 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1420 |
var err error |
| 1421 |
resp, err = executeRPC(ctx, c.client.ListDeployments, req, settings.GRPC, c.logger, "ListDeployments") |
| 1422 |
return err |
| 1423 |
}, opts...) |
| 1424 |
if err != nil { |
| 1425 |
return nil, "", err |
| 1426 |
} |
| 1427 |
|
| 1428 |
it.Response = resp |
| 1429 |
return resp.GetDeployments(), resp.GetNextPageToken(), nil |
| 1430 |
} |
| 1431 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1432 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1433 |
if err != nil { |
| 1434 |
return "", err |
| 1435 |
} |
| 1436 |
it.items = append(it.items, items...) |
| 1437 |
return nextPageToken, nil |
| 1438 |
} |
| 1439 |
|
| 1440 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1441 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1442 |
it.pageInfo.Token = req.GetPageToken() |
| 1443 |
|
| 1444 |
return it |
| 1445 |
} |
| 1446 |
|
| 1447 |
func (c *gRPCClient) ListDeploymentRevisions(ctx context.Context, req *telcoautomationpb.ListDeploymentRevisionsRequest, opts ...gax.CallOption) *DeploymentIterator { |
| 1448 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1449 |
|
| 1450 |
hds = append(c.xGoogHeaders, hds...) |
| 1451 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1452 |
opts = append((*c.CallOptions).ListDeploymentRevisions[0:len((*c.CallOptions).ListDeploymentRevisions):len((*c.CallOptions).ListDeploymentRevisions)], opts...) |
| 1453 |
it := &DeploymentIterator{} |
| 1454 |
req = proto.Clone(req).(*telcoautomationpb.ListDeploymentRevisionsRequest) |
| 1455 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.Deployment, string, error) { |
| 1456 |
resp := &telcoautomationpb.ListDeploymentRevisionsResponse{} |
| 1457 |
if pageToken != "" { |
| 1458 |
req.PageToken = pageToken |
| 1459 |
} |
| 1460 |
if pageSize > math.MaxInt32 { |
| 1461 |
req.PageSize = math.MaxInt32 |
| 1462 |
} else if pageSize != 0 { |
| 1463 |
req.PageSize = int32(pageSize) |
| 1464 |
} |
| 1465 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1466 |
var err error |
| 1467 |
resp, err = executeRPC(ctx, c.client.ListDeploymentRevisions, req, settings.GRPC, c.logger, "ListDeploymentRevisions") |
| 1468 |
return err |
| 1469 |
}, opts...) |
| 1470 |
if err != nil { |
| 1471 |
return nil, "", err |
| 1472 |
} |
| 1473 |
|
| 1474 |
it.Response = resp |
| 1475 |
return resp.GetDeployments(), resp.GetNextPageToken(), nil |
| 1476 |
} |
| 1477 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1478 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1479 |
if err != nil { |
| 1480 |
return "", err |
| 1481 |
} |
| 1482 |
it.items = append(it.items, items...) |
| 1483 |
return nextPageToken, nil |
| 1484 |
} |
| 1485 |
|
| 1486 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1487 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1488 |
it.pageInfo.Token = req.GetPageToken() |
| 1489 |
|
| 1490 |
return it |
| 1491 |
} |
| 1492 |
|
| 1493 |
func (c *gRPCClient) DiscardDeploymentChanges(ctx context.Context, req *telcoautomationpb.DiscardDeploymentChangesRequest, opts ...gax.CallOption) (*telcoautomationpb.DiscardDeploymentChangesResponse, error) { |
| 1494 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1495 |
|
| 1496 |
hds = append(c.xGoogHeaders, hds...) |
| 1497 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1498 |
opts = append((*c.CallOptions).DiscardDeploymentChanges[0:len((*c.CallOptions).DiscardDeploymentChanges):len((*c.CallOptions).DiscardDeploymentChanges)], opts...) |
| 1499 |
var resp *telcoautomationpb.DiscardDeploymentChangesResponse |
| 1500 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1501 |
var err error |
| 1502 |
resp, err = executeRPC(ctx, c.client.DiscardDeploymentChanges, req, settings.GRPC, c.logger, "DiscardDeploymentChanges") |
| 1503 |
return err |
| 1504 |
}, opts...) |
| 1505 |
if err != nil { |
| 1506 |
return nil, err |
| 1507 |
} |
| 1508 |
return resp, nil |
| 1509 |
} |
| 1510 |
|
| 1511 |
func (c *gRPCClient) ApplyDeployment(ctx context.Context, req *telcoautomationpb.ApplyDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 1512 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1513 |
|
| 1514 |
hds = append(c.xGoogHeaders, hds...) |
| 1515 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1516 |
opts = append((*c.CallOptions).ApplyDeployment[0:len((*c.CallOptions).ApplyDeployment):len((*c.CallOptions).ApplyDeployment)], opts...) |
| 1517 |
var resp *telcoautomationpb.Deployment |
| 1518 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1519 |
var err error |
| 1520 |
resp, err = executeRPC(ctx, c.client.ApplyDeployment, req, settings.GRPC, c.logger, "ApplyDeployment") |
| 1521 |
return err |
| 1522 |
}, opts...) |
| 1523 |
if err != nil { |
| 1524 |
return nil, err |
| 1525 |
} |
| 1526 |
return resp, nil |
| 1527 |
} |
| 1528 |
|
| 1529 |
func (c *gRPCClient) ComputeDeploymentStatus(ctx context.Context, req *telcoautomationpb.ComputeDeploymentStatusRequest, opts ...gax.CallOption) (*telcoautomationpb.ComputeDeploymentStatusResponse, error) { |
| 1530 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1531 |
|
| 1532 |
hds = append(c.xGoogHeaders, hds...) |
| 1533 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1534 |
opts = append((*c.CallOptions).ComputeDeploymentStatus[0:len((*c.CallOptions).ComputeDeploymentStatus):len((*c.CallOptions).ComputeDeploymentStatus)], opts...) |
| 1535 |
var resp *telcoautomationpb.ComputeDeploymentStatusResponse |
| 1536 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1537 |
var err error |
| 1538 |
resp, err = executeRPC(ctx, c.client.ComputeDeploymentStatus, req, settings.GRPC, c.logger, "ComputeDeploymentStatus") |
| 1539 |
return err |
| 1540 |
}, opts...) |
| 1541 |
if err != nil { |
| 1542 |
return nil, err |
| 1543 |
} |
| 1544 |
return resp, nil |
| 1545 |
} |
| 1546 |
|
| 1547 |
func (c *gRPCClient) RollbackDeployment(ctx context.Context, req *telcoautomationpb.RollbackDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 1548 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1549 |
|
| 1550 |
hds = append(c.xGoogHeaders, hds...) |
| 1551 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1552 |
opts = append((*c.CallOptions).RollbackDeployment[0:len((*c.CallOptions).RollbackDeployment):len((*c.CallOptions).RollbackDeployment)], opts...) |
| 1553 |
var resp *telcoautomationpb.Deployment |
| 1554 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1555 |
var err error |
| 1556 |
resp, err = executeRPC(ctx, c.client.RollbackDeployment, req, settings.GRPC, c.logger, "RollbackDeployment") |
| 1557 |
return err |
| 1558 |
}, opts...) |
| 1559 |
if err != nil { |
| 1560 |
return nil, err |
| 1561 |
} |
| 1562 |
return resp, nil |
| 1563 |
} |
| 1564 |
|
| 1565 |
func (c *gRPCClient) GetHydratedDeployment(ctx context.Context, req *telcoautomationpb.GetHydratedDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.HydratedDeployment, error) { |
| 1566 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1567 |
|
| 1568 |
hds = append(c.xGoogHeaders, hds...) |
| 1569 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1570 |
opts = append((*c.CallOptions).GetHydratedDeployment[0:len((*c.CallOptions).GetHydratedDeployment):len((*c.CallOptions).GetHydratedDeployment)], opts...) |
| 1571 |
var resp *telcoautomationpb.HydratedDeployment |
| 1572 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1573 |
var err error |
| 1574 |
resp, err = executeRPC(ctx, c.client.GetHydratedDeployment, req, settings.GRPC, c.logger, "GetHydratedDeployment") |
| 1575 |
return err |
| 1576 |
}, opts...) |
| 1577 |
if err != nil { |
| 1578 |
return nil, err |
| 1579 |
} |
| 1580 |
return resp, nil |
| 1581 |
} |
| 1582 |
|
| 1583 |
func (c *gRPCClient) ListHydratedDeployments(ctx context.Context, req *telcoautomationpb.ListHydratedDeploymentsRequest, opts ...gax.CallOption) *HydratedDeploymentIterator { |
| 1584 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1585 |
|
| 1586 |
hds = append(c.xGoogHeaders, hds...) |
| 1587 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1588 |
opts = append((*c.CallOptions).ListHydratedDeployments[0:len((*c.CallOptions).ListHydratedDeployments):len((*c.CallOptions).ListHydratedDeployments)], opts...) |
| 1589 |
it := &HydratedDeploymentIterator{} |
| 1590 |
req = proto.Clone(req).(*telcoautomationpb.ListHydratedDeploymentsRequest) |
| 1591 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.HydratedDeployment, string, error) { |
| 1592 |
resp := &telcoautomationpb.ListHydratedDeploymentsResponse{} |
| 1593 |
if pageToken != "" { |
| 1594 |
req.PageToken = pageToken |
| 1595 |
} |
| 1596 |
if pageSize > math.MaxInt32 { |
| 1597 |
req.PageSize = math.MaxInt32 |
| 1598 |
} else if pageSize != 0 { |
| 1599 |
req.PageSize = int32(pageSize) |
| 1600 |
} |
| 1601 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1602 |
var err error |
| 1603 |
resp, err = executeRPC(ctx, c.client.ListHydratedDeployments, req, settings.GRPC, c.logger, "ListHydratedDeployments") |
| 1604 |
return err |
| 1605 |
}, opts...) |
| 1606 |
if err != nil { |
| 1607 |
return nil, "", err |
| 1608 |
} |
| 1609 |
|
| 1610 |
it.Response = resp |
| 1611 |
return resp.GetHydratedDeployments(), resp.GetNextPageToken(), nil |
| 1612 |
} |
| 1613 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1614 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1615 |
if err != nil { |
| 1616 |
return "", err |
| 1617 |
} |
| 1618 |
it.items = append(it.items, items...) |
| 1619 |
return nextPageToken, nil |
| 1620 |
} |
| 1621 |
|
| 1622 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1623 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1624 |
it.pageInfo.Token = req.GetPageToken() |
| 1625 |
|
| 1626 |
return it |
| 1627 |
} |
| 1628 |
|
| 1629 |
func (c *gRPCClient) UpdateHydratedDeployment(ctx context.Context, req *telcoautomationpb.UpdateHydratedDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.HydratedDeployment, error) { |
| 1630 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "hydrated_deployment.name", url.QueryEscape(req.GetHydratedDeployment().GetName()))} |
| 1631 |
|
| 1632 |
hds = append(c.xGoogHeaders, hds...) |
| 1633 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1634 |
opts = append((*c.CallOptions).UpdateHydratedDeployment[0:len((*c.CallOptions).UpdateHydratedDeployment):len((*c.CallOptions).UpdateHydratedDeployment)], opts...) |
| 1635 |
var resp *telcoautomationpb.HydratedDeployment |
| 1636 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1637 |
var err error |
| 1638 |
resp, err = executeRPC(ctx, c.client.UpdateHydratedDeployment, req, settings.GRPC, c.logger, "UpdateHydratedDeployment") |
| 1639 |
return err |
| 1640 |
}, opts...) |
| 1641 |
if err != nil { |
| 1642 |
return nil, err |
| 1643 |
} |
| 1644 |
return resp, nil |
| 1645 |
} |
| 1646 |
|
| 1647 |
func (c *gRPCClient) ApplyHydratedDeployment(ctx context.Context, req *telcoautomationpb.ApplyHydratedDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.HydratedDeployment, error) { |
| 1648 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1649 |
|
| 1650 |
hds = append(c.xGoogHeaders, hds...) |
| 1651 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1652 |
opts = append((*c.CallOptions).ApplyHydratedDeployment[0:len((*c.CallOptions).ApplyHydratedDeployment):len((*c.CallOptions).ApplyHydratedDeployment)], opts...) |
| 1653 |
var resp *telcoautomationpb.HydratedDeployment |
| 1654 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1655 |
var err error |
| 1656 |
resp, err = executeRPC(ctx, c.client.ApplyHydratedDeployment, req, settings.GRPC, c.logger, "ApplyHydratedDeployment") |
| 1657 |
return err |
| 1658 |
}, opts...) |
| 1659 |
if err != nil { |
| 1660 |
return nil, err |
| 1661 |
} |
| 1662 |
return resp, nil |
| 1663 |
} |
| 1664 |
|
| 1665 |
func (c *gRPCClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { |
| 1666 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1667 |
|
| 1668 |
hds = append(c.xGoogHeaders, hds...) |
| 1669 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1670 |
opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...) |
| 1671 |
var resp *locationpb.Location |
| 1672 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1673 |
var err error |
| 1674 |
resp, err = executeRPC(ctx, c.locationsClient.GetLocation, req, settings.GRPC, c.logger, "GetLocation") |
| 1675 |
return err |
| 1676 |
}, opts...) |
| 1677 |
if err != nil { |
| 1678 |
return nil, err |
| 1679 |
} |
| 1680 |
return resp, nil |
| 1681 |
} |
| 1682 |
|
| 1683 |
func (c *gRPCClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { |
| 1684 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1685 |
|
| 1686 |
hds = append(c.xGoogHeaders, hds...) |
| 1687 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1688 |
opts = append((*c.CallOptions).ListLocations[0:len((*c.CallOptions).ListLocations):len((*c.CallOptions).ListLocations)], opts...) |
| 1689 |
it := &LocationIterator{} |
| 1690 |
req = proto.Clone(req).(*locationpb.ListLocationsRequest) |
| 1691 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) { |
| 1692 |
resp := &locationpb.ListLocationsResponse{} |
| 1693 |
if pageToken != "" { |
| 1694 |
req.PageToken = pageToken |
| 1695 |
} |
| 1696 |
if pageSize > math.MaxInt32 { |
| 1697 |
req.PageSize = math.MaxInt32 |
| 1698 |
} else if pageSize != 0 { |
| 1699 |
req.PageSize = int32(pageSize) |
| 1700 |
} |
| 1701 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1702 |
var err error |
| 1703 |
resp, err = executeRPC(ctx, c.locationsClient.ListLocations, req, settings.GRPC, c.logger, "ListLocations") |
| 1704 |
return err |
| 1705 |
}, opts...) |
| 1706 |
if err != nil { |
| 1707 |
return nil, "", err |
| 1708 |
} |
| 1709 |
|
| 1710 |
it.Response = resp |
| 1711 |
return resp.GetLocations(), resp.GetNextPageToken(), nil |
| 1712 |
} |
| 1713 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1714 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1715 |
if err != nil { |
| 1716 |
return "", err |
| 1717 |
} |
| 1718 |
it.items = append(it.items, items...) |
| 1719 |
return nextPageToken, nil |
| 1720 |
} |
| 1721 |
|
| 1722 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1723 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1724 |
it.pageInfo.Token = req.GetPageToken() |
| 1725 |
|
| 1726 |
return it |
| 1727 |
} |
| 1728 |
|
| 1729 |
func (c *gRPCClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { |
| 1730 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1731 |
|
| 1732 |
hds = append(c.xGoogHeaders, hds...) |
| 1733 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1734 |
opts = append((*c.CallOptions).CancelOperation[0:len((*c.CallOptions).CancelOperation):len((*c.CallOptions).CancelOperation)], opts...) |
| 1735 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1736 |
var err error |
| 1737 |
_, err = executeRPC(ctx, c.operationsClient.CancelOperation, req, settings.GRPC, c.logger, "CancelOperation") |
| 1738 |
return err |
| 1739 |
}, opts...) |
| 1740 |
return err |
| 1741 |
} |
| 1742 |
|
| 1743 |
func (c *gRPCClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { |
| 1744 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1745 |
|
| 1746 |
hds = append(c.xGoogHeaders, hds...) |
| 1747 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1748 |
opts = append((*c.CallOptions).DeleteOperation[0:len((*c.CallOptions).DeleteOperation):len((*c.CallOptions).DeleteOperation)], opts...) |
| 1749 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1750 |
var err error |
| 1751 |
_, err = executeRPC(ctx, c.operationsClient.DeleteOperation, req, settings.GRPC, c.logger, "DeleteOperation") |
| 1752 |
return err |
| 1753 |
}, opts...) |
| 1754 |
return err |
| 1755 |
} |
| 1756 |
|
| 1757 |
func (c *gRPCClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { |
| 1758 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1759 |
|
| 1760 |
hds = append(c.xGoogHeaders, hds...) |
| 1761 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1762 |
opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) |
| 1763 |
var resp *longrunningpb.Operation |
| 1764 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1765 |
var err error |
| 1766 |
resp, err = executeRPC(ctx, c.operationsClient.GetOperation, req, settings.GRPC, c.logger, "GetOperation") |
| 1767 |
return err |
| 1768 |
}, opts...) |
| 1769 |
if err != nil { |
| 1770 |
return nil, err |
| 1771 |
} |
| 1772 |
return resp, nil |
| 1773 |
} |
| 1774 |
|
| 1775 |
func (c *gRPCClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { |
| 1776 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1777 |
|
| 1778 |
hds = append(c.xGoogHeaders, hds...) |
| 1779 |
ctx = gax.InsertMetadataIntoOutgoingContext(ctx, hds...) |
| 1780 |
opts = append((*c.CallOptions).ListOperations[0:len((*c.CallOptions).ListOperations):len((*c.CallOptions).ListOperations)], opts...) |
| 1781 |
it := &OperationIterator{} |
| 1782 |
req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) |
| 1783 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { |
| 1784 |
resp := &longrunningpb.ListOperationsResponse{} |
| 1785 |
if pageToken != "" { |
| 1786 |
req.PageToken = pageToken |
| 1787 |
} |
| 1788 |
if pageSize > math.MaxInt32 { |
| 1789 |
req.PageSize = math.MaxInt32 |
| 1790 |
} else if pageSize != 0 { |
| 1791 |
req.PageSize = int32(pageSize) |
| 1792 |
} |
| 1793 |
err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1794 |
var err error |
| 1795 |
resp, err = executeRPC(ctx, c.operationsClient.ListOperations, req, settings.GRPC, c.logger, "ListOperations") |
| 1796 |
return err |
| 1797 |
}, opts...) |
| 1798 |
if err != nil { |
| 1799 |
return nil, "", err |
| 1800 |
} |
| 1801 |
|
| 1802 |
it.Response = resp |
| 1803 |
return resp.GetOperations(), resp.GetNextPageToken(), nil |
| 1804 |
} |
| 1805 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1806 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1807 |
if err != nil { |
| 1808 |
return "", err |
| 1809 |
} |
| 1810 |
it.items = append(it.items, items...) |
| 1811 |
return nextPageToken, nil |
| 1812 |
} |
| 1813 |
|
| 1814 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1815 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1816 |
it.pageInfo.Token = req.GetPageToken() |
| 1817 |
|
| 1818 |
return it |
| 1819 |
} |
| 1820 |
|
| 1821 |
|
| 1822 |
func (c *restClient) ListOrchestrationClusters(ctx context.Context, req *telcoautomationpb.ListOrchestrationClustersRequest, opts ...gax.CallOption) *OrchestrationClusterIterator { |
| 1823 |
it := &OrchestrationClusterIterator{} |
| 1824 |
req = proto.Clone(req).(*telcoautomationpb.ListOrchestrationClustersRequest) |
| 1825 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1826 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.OrchestrationCluster, string, error) { |
| 1827 |
resp := &telcoautomationpb.ListOrchestrationClustersResponse{} |
| 1828 |
if pageToken != "" { |
| 1829 |
req.PageToken = pageToken |
| 1830 |
} |
| 1831 |
if pageSize > math.MaxInt32 { |
| 1832 |
req.PageSize = math.MaxInt32 |
| 1833 |
} else if pageSize != 0 { |
| 1834 |
req.PageSize = int32(pageSize) |
| 1835 |
} |
| 1836 |
baseUrl, err := url.Parse(c.endpoint) |
| 1837 |
if err != nil { |
| 1838 |
return nil, "", err |
| 1839 |
} |
| 1840 |
baseUrl.Path += fmt.Sprintf("/v1/%v/orchestrationClusters", req.GetParent()) |
| 1841 |
|
| 1842 |
params := url.Values{} |
| 1843 |
params.Add("$alt", "json;enum-encoding=int") |
| 1844 |
if req.GetFilter() != "" { |
| 1845 |
params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) |
| 1846 |
} |
| 1847 |
if req.GetOrderBy() != "" { |
| 1848 |
params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) |
| 1849 |
} |
| 1850 |
if req.GetPageSize() != 0 { |
| 1851 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 1852 |
} |
| 1853 |
if req.GetPageToken() != "" { |
| 1854 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 1855 |
} |
| 1856 |
|
| 1857 |
baseUrl.RawQuery = params.Encode() |
| 1858 |
|
| 1859 |
|
| 1860 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 1861 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1862 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1863 |
if settings.Path != "" { |
| 1864 |
baseUrl.Path = settings.Path |
| 1865 |
} |
| 1866 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 1867 |
if err != nil { |
| 1868 |
return err |
| 1869 |
} |
| 1870 |
httpReq.Header = headers |
| 1871 |
|
| 1872 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListOrchestrationClusters") |
| 1873 |
if err != nil { |
| 1874 |
return err |
| 1875 |
} |
| 1876 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1877 |
return err |
| 1878 |
} |
| 1879 |
|
| 1880 |
return nil |
| 1881 |
}, opts...) |
| 1882 |
if e != nil { |
| 1883 |
return nil, "", e |
| 1884 |
} |
| 1885 |
it.Response = resp |
| 1886 |
return resp.GetOrchestrationClusters(), resp.GetNextPageToken(), nil |
| 1887 |
} |
| 1888 |
|
| 1889 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 1890 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 1891 |
if err != nil { |
| 1892 |
return "", err |
| 1893 |
} |
| 1894 |
it.items = append(it.items, items...) |
| 1895 |
return nextPageToken, nil |
| 1896 |
} |
| 1897 |
|
| 1898 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 1899 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 1900 |
it.pageInfo.Token = req.GetPageToken() |
| 1901 |
|
| 1902 |
return it |
| 1903 |
} |
| 1904 |
|
| 1905 |
|
| 1906 |
func (c *restClient) GetOrchestrationCluster(ctx context.Context, req *telcoautomationpb.GetOrchestrationClusterRequest, opts ...gax.CallOption) (*telcoautomationpb.OrchestrationCluster, error) { |
| 1907 |
baseUrl, err := url.Parse(c.endpoint) |
| 1908 |
if err != nil { |
| 1909 |
return nil, err |
| 1910 |
} |
| 1911 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 1912 |
|
| 1913 |
params := url.Values{} |
| 1914 |
params.Add("$alt", "json;enum-encoding=int") |
| 1915 |
|
| 1916 |
baseUrl.RawQuery = params.Encode() |
| 1917 |
|
| 1918 |
|
| 1919 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 1920 |
|
| 1921 |
hds = append(c.xGoogHeaders, hds...) |
| 1922 |
hds = append(hds, "Content-Type", "application/json") |
| 1923 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1924 |
opts = append((*c.CallOptions).GetOrchestrationCluster[0:len((*c.CallOptions).GetOrchestrationCluster):len((*c.CallOptions).GetOrchestrationCluster)], opts...) |
| 1925 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1926 |
resp := &telcoautomationpb.OrchestrationCluster{} |
| 1927 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1928 |
if settings.Path != "" { |
| 1929 |
baseUrl.Path = settings.Path |
| 1930 |
} |
| 1931 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 1932 |
if err != nil { |
| 1933 |
return err |
| 1934 |
} |
| 1935 |
httpReq = httpReq.WithContext(ctx) |
| 1936 |
httpReq.Header = headers |
| 1937 |
|
| 1938 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetOrchestrationCluster") |
| 1939 |
if err != nil { |
| 1940 |
return err |
| 1941 |
} |
| 1942 |
|
| 1943 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 1944 |
return err |
| 1945 |
} |
| 1946 |
|
| 1947 |
return nil |
| 1948 |
}, opts...) |
| 1949 |
if e != nil { |
| 1950 |
return nil, e |
| 1951 |
} |
| 1952 |
return resp, nil |
| 1953 |
} |
| 1954 |
|
| 1955 |
|
| 1956 |
func (c *restClient) CreateOrchestrationCluster(ctx context.Context, req *telcoautomationpb.CreateOrchestrationClusterRequest, opts ...gax.CallOption) (*CreateOrchestrationClusterOperation, error) { |
| 1957 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 1958 |
body := req.GetOrchestrationCluster() |
| 1959 |
jsonReq, err := m.Marshal(body) |
| 1960 |
if err != nil { |
| 1961 |
return nil, err |
| 1962 |
} |
| 1963 |
|
| 1964 |
baseUrl, err := url.Parse(c.endpoint) |
| 1965 |
if err != nil { |
| 1966 |
return nil, err |
| 1967 |
} |
| 1968 |
baseUrl.Path += fmt.Sprintf("/v1/%v/orchestrationClusters", req.GetParent()) |
| 1969 |
|
| 1970 |
params := url.Values{} |
| 1971 |
params.Add("$alt", "json;enum-encoding=int") |
| 1972 |
params.Add("orchestrationClusterId", fmt.Sprintf("%v", req.GetOrchestrationClusterId())) |
| 1973 |
if req.GetRequestId() != "" { |
| 1974 |
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) |
| 1975 |
} |
| 1976 |
|
| 1977 |
baseUrl.RawQuery = params.Encode() |
| 1978 |
|
| 1979 |
|
| 1980 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 1981 |
|
| 1982 |
hds = append(c.xGoogHeaders, hds...) |
| 1983 |
hds = append(hds, "Content-Type", "application/json") |
| 1984 |
headers := gax.BuildHeaders(ctx, hds...) |
| 1985 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 1986 |
resp := &longrunningpb.Operation{} |
| 1987 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 1988 |
if settings.Path != "" { |
| 1989 |
baseUrl.Path = settings.Path |
| 1990 |
} |
| 1991 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 1992 |
if err != nil { |
| 1993 |
return err |
| 1994 |
} |
| 1995 |
httpReq = httpReq.WithContext(ctx) |
| 1996 |
httpReq.Header = headers |
| 1997 |
|
| 1998 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateOrchestrationCluster") |
| 1999 |
if err != nil { |
| 2000 |
return err |
| 2001 |
} |
| 2002 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2003 |
return err |
| 2004 |
} |
| 2005 |
|
| 2006 |
return nil |
| 2007 |
}, opts...) |
| 2008 |
if e != nil { |
| 2009 |
return nil, e |
| 2010 |
} |
| 2011 |
|
| 2012 |
override := fmt.Sprintf("/v1/%s", resp.GetName()) |
| 2013 |
return &CreateOrchestrationClusterOperation{ |
| 2014 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 2015 |
pollPath: override, |
| 2016 |
}, nil |
| 2017 |
} |
| 2018 |
|
| 2019 |
|
| 2020 |
func (c *restClient) DeleteOrchestrationCluster(ctx context.Context, req *telcoautomationpb.DeleteOrchestrationClusterRequest, opts ...gax.CallOption) (*DeleteOrchestrationClusterOperation, error) { |
| 2021 |
baseUrl, err := url.Parse(c.endpoint) |
| 2022 |
if err != nil { |
| 2023 |
return nil, err |
| 2024 |
} |
| 2025 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 2026 |
|
| 2027 |
params := url.Values{} |
| 2028 |
params.Add("$alt", "json;enum-encoding=int") |
| 2029 |
if req.GetRequestId() != "" { |
| 2030 |
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) |
| 2031 |
} |
| 2032 |
|
| 2033 |
baseUrl.RawQuery = params.Encode() |
| 2034 |
|
| 2035 |
|
| 2036 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 2037 |
|
| 2038 |
hds = append(c.xGoogHeaders, hds...) |
| 2039 |
hds = append(hds, "Content-Type", "application/json") |
| 2040 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2041 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2042 |
resp := &longrunningpb.Operation{} |
| 2043 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2044 |
if settings.Path != "" { |
| 2045 |
baseUrl.Path = settings.Path |
| 2046 |
} |
| 2047 |
httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) |
| 2048 |
if err != nil { |
| 2049 |
return err |
| 2050 |
} |
| 2051 |
httpReq = httpReq.WithContext(ctx) |
| 2052 |
httpReq.Header = headers |
| 2053 |
|
| 2054 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteOrchestrationCluster") |
| 2055 |
if err != nil { |
| 2056 |
return err |
| 2057 |
} |
| 2058 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2059 |
return err |
| 2060 |
} |
| 2061 |
|
| 2062 |
return nil |
| 2063 |
}, opts...) |
| 2064 |
if e != nil { |
| 2065 |
return nil, e |
| 2066 |
} |
| 2067 |
|
| 2068 |
override := fmt.Sprintf("/v1/%s", resp.GetName()) |
| 2069 |
return &DeleteOrchestrationClusterOperation{ |
| 2070 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 2071 |
pollPath: override, |
| 2072 |
}, nil |
| 2073 |
} |
| 2074 |
|
| 2075 |
|
| 2076 |
func (c *restClient) ListEdgeSlms(ctx context.Context, req *telcoautomationpb.ListEdgeSlmsRequest, opts ...gax.CallOption) *EdgeSlmIterator { |
| 2077 |
it := &EdgeSlmIterator{} |
| 2078 |
req = proto.Clone(req).(*telcoautomationpb.ListEdgeSlmsRequest) |
| 2079 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2080 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.EdgeSlm, string, error) { |
| 2081 |
resp := &telcoautomationpb.ListEdgeSlmsResponse{} |
| 2082 |
if pageToken != "" { |
| 2083 |
req.PageToken = pageToken |
| 2084 |
} |
| 2085 |
if pageSize > math.MaxInt32 { |
| 2086 |
req.PageSize = math.MaxInt32 |
| 2087 |
} else if pageSize != 0 { |
| 2088 |
req.PageSize = int32(pageSize) |
| 2089 |
} |
| 2090 |
baseUrl, err := url.Parse(c.endpoint) |
| 2091 |
if err != nil { |
| 2092 |
return nil, "", err |
| 2093 |
} |
| 2094 |
baseUrl.Path += fmt.Sprintf("/v1/%v/edgeSlms", req.GetParent()) |
| 2095 |
|
| 2096 |
params := url.Values{} |
| 2097 |
params.Add("$alt", "json;enum-encoding=int") |
| 2098 |
if req.GetFilter() != "" { |
| 2099 |
params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) |
| 2100 |
} |
| 2101 |
if req.GetOrderBy() != "" { |
| 2102 |
params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy())) |
| 2103 |
} |
| 2104 |
if req.GetPageSize() != 0 { |
| 2105 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 2106 |
} |
| 2107 |
if req.GetPageToken() != "" { |
| 2108 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 2109 |
} |
| 2110 |
|
| 2111 |
baseUrl.RawQuery = params.Encode() |
| 2112 |
|
| 2113 |
|
| 2114 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 2115 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2116 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2117 |
if settings.Path != "" { |
| 2118 |
baseUrl.Path = settings.Path |
| 2119 |
} |
| 2120 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 2121 |
if err != nil { |
| 2122 |
return err |
| 2123 |
} |
| 2124 |
httpReq.Header = headers |
| 2125 |
|
| 2126 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListEdgeSlms") |
| 2127 |
if err != nil { |
| 2128 |
return err |
| 2129 |
} |
| 2130 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2131 |
return err |
| 2132 |
} |
| 2133 |
|
| 2134 |
return nil |
| 2135 |
}, opts...) |
| 2136 |
if e != nil { |
| 2137 |
return nil, "", e |
| 2138 |
} |
| 2139 |
it.Response = resp |
| 2140 |
return resp.GetEdgeSlms(), resp.GetNextPageToken(), nil |
| 2141 |
} |
| 2142 |
|
| 2143 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 2144 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 2145 |
if err != nil { |
| 2146 |
return "", err |
| 2147 |
} |
| 2148 |
it.items = append(it.items, items...) |
| 2149 |
return nextPageToken, nil |
| 2150 |
} |
| 2151 |
|
| 2152 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 2153 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 2154 |
it.pageInfo.Token = req.GetPageToken() |
| 2155 |
|
| 2156 |
return it |
| 2157 |
} |
| 2158 |
|
| 2159 |
|
| 2160 |
func (c *restClient) GetEdgeSlm(ctx context.Context, req *telcoautomationpb.GetEdgeSlmRequest, opts ...gax.CallOption) (*telcoautomationpb.EdgeSlm, error) { |
| 2161 |
baseUrl, err := url.Parse(c.endpoint) |
| 2162 |
if err != nil { |
| 2163 |
return nil, err |
| 2164 |
} |
| 2165 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 2166 |
|
| 2167 |
params := url.Values{} |
| 2168 |
params.Add("$alt", "json;enum-encoding=int") |
| 2169 |
|
| 2170 |
baseUrl.RawQuery = params.Encode() |
| 2171 |
|
| 2172 |
|
| 2173 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 2174 |
|
| 2175 |
hds = append(c.xGoogHeaders, hds...) |
| 2176 |
hds = append(hds, "Content-Type", "application/json") |
| 2177 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2178 |
opts = append((*c.CallOptions).GetEdgeSlm[0:len((*c.CallOptions).GetEdgeSlm):len((*c.CallOptions).GetEdgeSlm)], opts...) |
| 2179 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2180 |
resp := &telcoautomationpb.EdgeSlm{} |
| 2181 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2182 |
if settings.Path != "" { |
| 2183 |
baseUrl.Path = settings.Path |
| 2184 |
} |
| 2185 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 2186 |
if err != nil { |
| 2187 |
return err |
| 2188 |
} |
| 2189 |
httpReq = httpReq.WithContext(ctx) |
| 2190 |
httpReq.Header = headers |
| 2191 |
|
| 2192 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetEdgeSlm") |
| 2193 |
if err != nil { |
| 2194 |
return err |
| 2195 |
} |
| 2196 |
|
| 2197 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2198 |
return err |
| 2199 |
} |
| 2200 |
|
| 2201 |
return nil |
| 2202 |
}, opts...) |
| 2203 |
if e != nil { |
| 2204 |
return nil, e |
| 2205 |
} |
| 2206 |
return resp, nil |
| 2207 |
} |
| 2208 |
|
| 2209 |
|
| 2210 |
func (c *restClient) CreateEdgeSlm(ctx context.Context, req *telcoautomationpb.CreateEdgeSlmRequest, opts ...gax.CallOption) (*CreateEdgeSlmOperation, error) { |
| 2211 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 2212 |
body := req.GetEdgeSlm() |
| 2213 |
jsonReq, err := m.Marshal(body) |
| 2214 |
if err != nil { |
| 2215 |
return nil, err |
| 2216 |
} |
| 2217 |
|
| 2218 |
baseUrl, err := url.Parse(c.endpoint) |
| 2219 |
if err != nil { |
| 2220 |
return nil, err |
| 2221 |
} |
| 2222 |
baseUrl.Path += fmt.Sprintf("/v1/%v/edgeSlms", req.GetParent()) |
| 2223 |
|
| 2224 |
params := url.Values{} |
| 2225 |
params.Add("$alt", "json;enum-encoding=int") |
| 2226 |
params.Add("edgeSlmId", fmt.Sprintf("%v", req.GetEdgeSlmId())) |
| 2227 |
if req.GetRequestId() != "" { |
| 2228 |
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) |
| 2229 |
} |
| 2230 |
|
| 2231 |
baseUrl.RawQuery = params.Encode() |
| 2232 |
|
| 2233 |
|
| 2234 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 2235 |
|
| 2236 |
hds = append(c.xGoogHeaders, hds...) |
| 2237 |
hds = append(hds, "Content-Type", "application/json") |
| 2238 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2239 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2240 |
resp := &longrunningpb.Operation{} |
| 2241 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2242 |
if settings.Path != "" { |
| 2243 |
baseUrl.Path = settings.Path |
| 2244 |
} |
| 2245 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 2246 |
if err != nil { |
| 2247 |
return err |
| 2248 |
} |
| 2249 |
httpReq = httpReq.WithContext(ctx) |
| 2250 |
httpReq.Header = headers |
| 2251 |
|
| 2252 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateEdgeSlm") |
| 2253 |
if err != nil { |
| 2254 |
return err |
| 2255 |
} |
| 2256 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2257 |
return err |
| 2258 |
} |
| 2259 |
|
| 2260 |
return nil |
| 2261 |
}, opts...) |
| 2262 |
if e != nil { |
| 2263 |
return nil, e |
| 2264 |
} |
| 2265 |
|
| 2266 |
override := fmt.Sprintf("/v1/%s", resp.GetName()) |
| 2267 |
return &CreateEdgeSlmOperation{ |
| 2268 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 2269 |
pollPath: override, |
| 2270 |
}, nil |
| 2271 |
} |
| 2272 |
|
| 2273 |
|
| 2274 |
func (c *restClient) DeleteEdgeSlm(ctx context.Context, req *telcoautomationpb.DeleteEdgeSlmRequest, opts ...gax.CallOption) (*DeleteEdgeSlmOperation, error) { |
| 2275 |
baseUrl, err := url.Parse(c.endpoint) |
| 2276 |
if err != nil { |
| 2277 |
return nil, err |
| 2278 |
} |
| 2279 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 2280 |
|
| 2281 |
params := url.Values{} |
| 2282 |
params.Add("$alt", "json;enum-encoding=int") |
| 2283 |
if req.GetRequestId() != "" { |
| 2284 |
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId())) |
| 2285 |
} |
| 2286 |
|
| 2287 |
baseUrl.RawQuery = params.Encode() |
| 2288 |
|
| 2289 |
|
| 2290 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 2291 |
|
| 2292 |
hds = append(c.xGoogHeaders, hds...) |
| 2293 |
hds = append(hds, "Content-Type", "application/json") |
| 2294 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2295 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2296 |
resp := &longrunningpb.Operation{} |
| 2297 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2298 |
if settings.Path != "" { |
| 2299 |
baseUrl.Path = settings.Path |
| 2300 |
} |
| 2301 |
httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) |
| 2302 |
if err != nil { |
| 2303 |
return err |
| 2304 |
} |
| 2305 |
httpReq = httpReq.WithContext(ctx) |
| 2306 |
httpReq.Header = headers |
| 2307 |
|
| 2308 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteEdgeSlm") |
| 2309 |
if err != nil { |
| 2310 |
return err |
| 2311 |
} |
| 2312 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2313 |
return err |
| 2314 |
} |
| 2315 |
|
| 2316 |
return nil |
| 2317 |
}, opts...) |
| 2318 |
if e != nil { |
| 2319 |
return nil, e |
| 2320 |
} |
| 2321 |
|
| 2322 |
override := fmt.Sprintf("/v1/%s", resp.GetName()) |
| 2323 |
return &DeleteEdgeSlmOperation{ |
| 2324 |
lro: longrunning.InternalNewOperation(*c.LROClient, resp), |
| 2325 |
pollPath: override, |
| 2326 |
}, nil |
| 2327 |
} |
| 2328 |
|
| 2329 |
|
| 2330 |
func (c *restClient) CreateBlueprint(ctx context.Context, req *telcoautomationpb.CreateBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 2331 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 2332 |
body := req.GetBlueprint() |
| 2333 |
jsonReq, err := m.Marshal(body) |
| 2334 |
if err != nil { |
| 2335 |
return nil, err |
| 2336 |
} |
| 2337 |
|
| 2338 |
baseUrl, err := url.Parse(c.endpoint) |
| 2339 |
if err != nil { |
| 2340 |
return nil, err |
| 2341 |
} |
| 2342 |
baseUrl.Path += fmt.Sprintf("/v1/%v/blueprints", req.GetParent()) |
| 2343 |
|
| 2344 |
params := url.Values{} |
| 2345 |
params.Add("$alt", "json;enum-encoding=int") |
| 2346 |
if req.GetBlueprintId() != "" { |
| 2347 |
params.Add("blueprintId", fmt.Sprintf("%v", req.GetBlueprintId())) |
| 2348 |
} |
| 2349 |
|
| 2350 |
baseUrl.RawQuery = params.Encode() |
| 2351 |
|
| 2352 |
|
| 2353 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 2354 |
|
| 2355 |
hds = append(c.xGoogHeaders, hds...) |
| 2356 |
hds = append(hds, "Content-Type", "application/json") |
| 2357 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2358 |
opts = append((*c.CallOptions).CreateBlueprint[0:len((*c.CallOptions).CreateBlueprint):len((*c.CallOptions).CreateBlueprint)], opts...) |
| 2359 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2360 |
resp := &telcoautomationpb.Blueprint{} |
| 2361 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2362 |
if settings.Path != "" { |
| 2363 |
baseUrl.Path = settings.Path |
| 2364 |
} |
| 2365 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 2366 |
if err != nil { |
| 2367 |
return err |
| 2368 |
} |
| 2369 |
httpReq = httpReq.WithContext(ctx) |
| 2370 |
httpReq.Header = headers |
| 2371 |
|
| 2372 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateBlueprint") |
| 2373 |
if err != nil { |
| 2374 |
return err |
| 2375 |
} |
| 2376 |
|
| 2377 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2378 |
return err |
| 2379 |
} |
| 2380 |
|
| 2381 |
return nil |
| 2382 |
}, opts...) |
| 2383 |
if e != nil { |
| 2384 |
return nil, e |
| 2385 |
} |
| 2386 |
return resp, nil |
| 2387 |
} |
| 2388 |
|
| 2389 |
|
| 2390 |
func (c *restClient) UpdateBlueprint(ctx context.Context, req *telcoautomationpb.UpdateBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 2391 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 2392 |
body := req.GetBlueprint() |
| 2393 |
jsonReq, err := m.Marshal(body) |
| 2394 |
if err != nil { |
| 2395 |
return nil, err |
| 2396 |
} |
| 2397 |
|
| 2398 |
baseUrl, err := url.Parse(c.endpoint) |
| 2399 |
if err != nil { |
| 2400 |
return nil, err |
| 2401 |
} |
| 2402 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetBlueprint().GetName()) |
| 2403 |
|
| 2404 |
params := url.Values{} |
| 2405 |
params.Add("$alt", "json;enum-encoding=int") |
| 2406 |
if req.GetUpdateMask() != nil { |
| 2407 |
field, err := protojson.Marshal(req.GetUpdateMask()) |
| 2408 |
if err != nil { |
| 2409 |
return nil, err |
| 2410 |
} |
| 2411 |
params.Add("updateMask", string(field[1:len(field)-1])) |
| 2412 |
} |
| 2413 |
|
| 2414 |
baseUrl.RawQuery = params.Encode() |
| 2415 |
|
| 2416 |
|
| 2417 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "blueprint.name", url.QueryEscape(req.GetBlueprint().GetName()))} |
| 2418 |
|
| 2419 |
hds = append(c.xGoogHeaders, hds...) |
| 2420 |
hds = append(hds, "Content-Type", "application/json") |
| 2421 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2422 |
opts = append((*c.CallOptions).UpdateBlueprint[0:len((*c.CallOptions).UpdateBlueprint):len((*c.CallOptions).UpdateBlueprint)], opts...) |
| 2423 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2424 |
resp := &telcoautomationpb.Blueprint{} |
| 2425 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2426 |
if settings.Path != "" { |
| 2427 |
baseUrl.Path = settings.Path |
| 2428 |
} |
| 2429 |
httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 2430 |
if err != nil { |
| 2431 |
return err |
| 2432 |
} |
| 2433 |
httpReq = httpReq.WithContext(ctx) |
| 2434 |
httpReq.Header = headers |
| 2435 |
|
| 2436 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateBlueprint") |
| 2437 |
if err != nil { |
| 2438 |
return err |
| 2439 |
} |
| 2440 |
|
| 2441 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2442 |
return err |
| 2443 |
} |
| 2444 |
|
| 2445 |
return nil |
| 2446 |
}, opts...) |
| 2447 |
if e != nil { |
| 2448 |
return nil, e |
| 2449 |
} |
| 2450 |
return resp, nil |
| 2451 |
} |
| 2452 |
|
| 2453 |
|
| 2454 |
func (c *restClient) GetBlueprint(ctx context.Context, req *telcoautomationpb.GetBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 2455 |
baseUrl, err := url.Parse(c.endpoint) |
| 2456 |
if err != nil { |
| 2457 |
return nil, err |
| 2458 |
} |
| 2459 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 2460 |
|
| 2461 |
params := url.Values{} |
| 2462 |
params.Add("$alt", "json;enum-encoding=int") |
| 2463 |
if req.GetView() != 0 { |
| 2464 |
params.Add("view", fmt.Sprintf("%v", req.GetView())) |
| 2465 |
} |
| 2466 |
|
| 2467 |
baseUrl.RawQuery = params.Encode() |
| 2468 |
|
| 2469 |
|
| 2470 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 2471 |
|
| 2472 |
hds = append(c.xGoogHeaders, hds...) |
| 2473 |
hds = append(hds, "Content-Type", "application/json") |
| 2474 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2475 |
opts = append((*c.CallOptions).GetBlueprint[0:len((*c.CallOptions).GetBlueprint):len((*c.CallOptions).GetBlueprint)], opts...) |
| 2476 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2477 |
resp := &telcoautomationpb.Blueprint{} |
| 2478 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2479 |
if settings.Path != "" { |
| 2480 |
baseUrl.Path = settings.Path |
| 2481 |
} |
| 2482 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 2483 |
if err != nil { |
| 2484 |
return err |
| 2485 |
} |
| 2486 |
httpReq = httpReq.WithContext(ctx) |
| 2487 |
httpReq.Header = headers |
| 2488 |
|
| 2489 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetBlueprint") |
| 2490 |
if err != nil { |
| 2491 |
return err |
| 2492 |
} |
| 2493 |
|
| 2494 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2495 |
return err |
| 2496 |
} |
| 2497 |
|
| 2498 |
return nil |
| 2499 |
}, opts...) |
| 2500 |
if e != nil { |
| 2501 |
return nil, e |
| 2502 |
} |
| 2503 |
return resp, nil |
| 2504 |
} |
| 2505 |
|
| 2506 |
|
| 2507 |
func (c *restClient) DeleteBlueprint(ctx context.Context, req *telcoautomationpb.DeleteBlueprintRequest, opts ...gax.CallOption) error { |
| 2508 |
baseUrl, err := url.Parse(c.endpoint) |
| 2509 |
if err != nil { |
| 2510 |
return err |
| 2511 |
} |
| 2512 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 2513 |
|
| 2514 |
params := url.Values{} |
| 2515 |
params.Add("$alt", "json;enum-encoding=int") |
| 2516 |
|
| 2517 |
baseUrl.RawQuery = params.Encode() |
| 2518 |
|
| 2519 |
|
| 2520 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 2521 |
|
| 2522 |
hds = append(c.xGoogHeaders, hds...) |
| 2523 |
hds = append(hds, "Content-Type", "application/json") |
| 2524 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2525 |
return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2526 |
if settings.Path != "" { |
| 2527 |
baseUrl.Path = settings.Path |
| 2528 |
} |
| 2529 |
httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) |
| 2530 |
if err != nil { |
| 2531 |
return err |
| 2532 |
} |
| 2533 |
httpReq = httpReq.WithContext(ctx) |
| 2534 |
httpReq.Header = headers |
| 2535 |
|
| 2536 |
_, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteBlueprint") |
| 2537 |
return err |
| 2538 |
}, opts...) |
| 2539 |
} |
| 2540 |
|
| 2541 |
|
| 2542 |
func (c *restClient) ListBlueprints(ctx context.Context, req *telcoautomationpb.ListBlueprintsRequest, opts ...gax.CallOption) *BlueprintIterator { |
| 2543 |
it := &BlueprintIterator{} |
| 2544 |
req = proto.Clone(req).(*telcoautomationpb.ListBlueprintsRequest) |
| 2545 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2546 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.Blueprint, string, error) { |
| 2547 |
resp := &telcoautomationpb.ListBlueprintsResponse{} |
| 2548 |
if pageToken != "" { |
| 2549 |
req.PageToken = pageToken |
| 2550 |
} |
| 2551 |
if pageSize > math.MaxInt32 { |
| 2552 |
req.PageSize = math.MaxInt32 |
| 2553 |
} else if pageSize != 0 { |
| 2554 |
req.PageSize = int32(pageSize) |
| 2555 |
} |
| 2556 |
baseUrl, err := url.Parse(c.endpoint) |
| 2557 |
if err != nil { |
| 2558 |
return nil, "", err |
| 2559 |
} |
| 2560 |
baseUrl.Path += fmt.Sprintf("/v1/%v/blueprints", req.GetParent()) |
| 2561 |
|
| 2562 |
params := url.Values{} |
| 2563 |
params.Add("$alt", "json;enum-encoding=int") |
| 2564 |
if req.GetFilter() != "" { |
| 2565 |
params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) |
| 2566 |
} |
| 2567 |
if req.GetPageSize() != 0 { |
| 2568 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 2569 |
} |
| 2570 |
if req.GetPageToken() != "" { |
| 2571 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 2572 |
} |
| 2573 |
|
| 2574 |
baseUrl.RawQuery = params.Encode() |
| 2575 |
|
| 2576 |
|
| 2577 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 2578 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2579 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2580 |
if settings.Path != "" { |
| 2581 |
baseUrl.Path = settings.Path |
| 2582 |
} |
| 2583 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 2584 |
if err != nil { |
| 2585 |
return err |
| 2586 |
} |
| 2587 |
httpReq.Header = headers |
| 2588 |
|
| 2589 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListBlueprints") |
| 2590 |
if err != nil { |
| 2591 |
return err |
| 2592 |
} |
| 2593 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2594 |
return err |
| 2595 |
} |
| 2596 |
|
| 2597 |
return nil |
| 2598 |
}, opts...) |
| 2599 |
if e != nil { |
| 2600 |
return nil, "", e |
| 2601 |
} |
| 2602 |
it.Response = resp |
| 2603 |
return resp.GetBlueprints(), resp.GetNextPageToken(), nil |
| 2604 |
} |
| 2605 |
|
| 2606 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 2607 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 2608 |
if err != nil { |
| 2609 |
return "", err |
| 2610 |
} |
| 2611 |
it.items = append(it.items, items...) |
| 2612 |
return nextPageToken, nil |
| 2613 |
} |
| 2614 |
|
| 2615 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 2616 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 2617 |
it.pageInfo.Token = req.GetPageToken() |
| 2618 |
|
| 2619 |
return it |
| 2620 |
} |
| 2621 |
|
| 2622 |
|
| 2623 |
func (c *restClient) ApproveBlueprint(ctx context.Context, req *telcoautomationpb.ApproveBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 2624 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 2625 |
jsonReq, err := m.Marshal(req) |
| 2626 |
if err != nil { |
| 2627 |
return nil, err |
| 2628 |
} |
| 2629 |
|
| 2630 |
baseUrl, err := url.Parse(c.endpoint) |
| 2631 |
if err != nil { |
| 2632 |
return nil, err |
| 2633 |
} |
| 2634 |
baseUrl.Path += fmt.Sprintf("/v1/%v:approve", req.GetName()) |
| 2635 |
|
| 2636 |
params := url.Values{} |
| 2637 |
params.Add("$alt", "json;enum-encoding=int") |
| 2638 |
|
| 2639 |
baseUrl.RawQuery = params.Encode() |
| 2640 |
|
| 2641 |
|
| 2642 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 2643 |
|
| 2644 |
hds = append(c.xGoogHeaders, hds...) |
| 2645 |
hds = append(hds, "Content-Type", "application/json") |
| 2646 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2647 |
opts = append((*c.CallOptions).ApproveBlueprint[0:len((*c.CallOptions).ApproveBlueprint):len((*c.CallOptions).ApproveBlueprint)], opts...) |
| 2648 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2649 |
resp := &telcoautomationpb.Blueprint{} |
| 2650 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2651 |
if settings.Path != "" { |
| 2652 |
baseUrl.Path = settings.Path |
| 2653 |
} |
| 2654 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 2655 |
if err != nil { |
| 2656 |
return err |
| 2657 |
} |
| 2658 |
httpReq = httpReq.WithContext(ctx) |
| 2659 |
httpReq.Header = headers |
| 2660 |
|
| 2661 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ApproveBlueprint") |
| 2662 |
if err != nil { |
| 2663 |
return err |
| 2664 |
} |
| 2665 |
|
| 2666 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2667 |
return err |
| 2668 |
} |
| 2669 |
|
| 2670 |
return nil |
| 2671 |
}, opts...) |
| 2672 |
if e != nil { |
| 2673 |
return nil, e |
| 2674 |
} |
| 2675 |
return resp, nil |
| 2676 |
} |
| 2677 |
|
| 2678 |
|
| 2679 |
func (c *restClient) ProposeBlueprint(ctx context.Context, req *telcoautomationpb.ProposeBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 2680 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 2681 |
jsonReq, err := m.Marshal(req) |
| 2682 |
if err != nil { |
| 2683 |
return nil, err |
| 2684 |
} |
| 2685 |
|
| 2686 |
baseUrl, err := url.Parse(c.endpoint) |
| 2687 |
if err != nil { |
| 2688 |
return nil, err |
| 2689 |
} |
| 2690 |
baseUrl.Path += fmt.Sprintf("/v1/%v:propose", req.GetName()) |
| 2691 |
|
| 2692 |
params := url.Values{} |
| 2693 |
params.Add("$alt", "json;enum-encoding=int") |
| 2694 |
|
| 2695 |
baseUrl.RawQuery = params.Encode() |
| 2696 |
|
| 2697 |
|
| 2698 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 2699 |
|
| 2700 |
hds = append(c.xGoogHeaders, hds...) |
| 2701 |
hds = append(hds, "Content-Type", "application/json") |
| 2702 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2703 |
opts = append((*c.CallOptions).ProposeBlueprint[0:len((*c.CallOptions).ProposeBlueprint):len((*c.CallOptions).ProposeBlueprint)], opts...) |
| 2704 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2705 |
resp := &telcoautomationpb.Blueprint{} |
| 2706 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2707 |
if settings.Path != "" { |
| 2708 |
baseUrl.Path = settings.Path |
| 2709 |
} |
| 2710 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 2711 |
if err != nil { |
| 2712 |
return err |
| 2713 |
} |
| 2714 |
httpReq = httpReq.WithContext(ctx) |
| 2715 |
httpReq.Header = headers |
| 2716 |
|
| 2717 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ProposeBlueprint") |
| 2718 |
if err != nil { |
| 2719 |
return err |
| 2720 |
} |
| 2721 |
|
| 2722 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2723 |
return err |
| 2724 |
} |
| 2725 |
|
| 2726 |
return nil |
| 2727 |
}, opts...) |
| 2728 |
if e != nil { |
| 2729 |
return nil, e |
| 2730 |
} |
| 2731 |
return resp, nil |
| 2732 |
} |
| 2733 |
|
| 2734 |
|
| 2735 |
func (c *restClient) RejectBlueprint(ctx context.Context, req *telcoautomationpb.RejectBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.Blueprint, error) { |
| 2736 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 2737 |
jsonReq, err := m.Marshal(req) |
| 2738 |
if err != nil { |
| 2739 |
return nil, err |
| 2740 |
} |
| 2741 |
|
| 2742 |
baseUrl, err := url.Parse(c.endpoint) |
| 2743 |
if err != nil { |
| 2744 |
return nil, err |
| 2745 |
} |
| 2746 |
baseUrl.Path += fmt.Sprintf("/v1/%v:reject", req.GetName()) |
| 2747 |
|
| 2748 |
params := url.Values{} |
| 2749 |
params.Add("$alt", "json;enum-encoding=int") |
| 2750 |
|
| 2751 |
baseUrl.RawQuery = params.Encode() |
| 2752 |
|
| 2753 |
|
| 2754 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 2755 |
|
| 2756 |
hds = append(c.xGoogHeaders, hds...) |
| 2757 |
hds = append(hds, "Content-Type", "application/json") |
| 2758 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2759 |
opts = append((*c.CallOptions).RejectBlueprint[0:len((*c.CallOptions).RejectBlueprint):len((*c.CallOptions).RejectBlueprint)], opts...) |
| 2760 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2761 |
resp := &telcoautomationpb.Blueprint{} |
| 2762 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2763 |
if settings.Path != "" { |
| 2764 |
baseUrl.Path = settings.Path |
| 2765 |
} |
| 2766 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 2767 |
if err != nil { |
| 2768 |
return err |
| 2769 |
} |
| 2770 |
httpReq = httpReq.WithContext(ctx) |
| 2771 |
httpReq.Header = headers |
| 2772 |
|
| 2773 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "RejectBlueprint") |
| 2774 |
if err != nil { |
| 2775 |
return err |
| 2776 |
} |
| 2777 |
|
| 2778 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2779 |
return err |
| 2780 |
} |
| 2781 |
|
| 2782 |
return nil |
| 2783 |
}, opts...) |
| 2784 |
if e != nil { |
| 2785 |
return nil, e |
| 2786 |
} |
| 2787 |
return resp, nil |
| 2788 |
} |
| 2789 |
|
| 2790 |
|
| 2791 |
func (c *restClient) ListBlueprintRevisions(ctx context.Context, req *telcoautomationpb.ListBlueprintRevisionsRequest, opts ...gax.CallOption) *BlueprintIterator { |
| 2792 |
it := &BlueprintIterator{} |
| 2793 |
req = proto.Clone(req).(*telcoautomationpb.ListBlueprintRevisionsRequest) |
| 2794 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2795 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.Blueprint, string, error) { |
| 2796 |
resp := &telcoautomationpb.ListBlueprintRevisionsResponse{} |
| 2797 |
if pageToken != "" { |
| 2798 |
req.PageToken = pageToken |
| 2799 |
} |
| 2800 |
if pageSize > math.MaxInt32 { |
| 2801 |
req.PageSize = math.MaxInt32 |
| 2802 |
} else if pageSize != 0 { |
| 2803 |
req.PageSize = int32(pageSize) |
| 2804 |
} |
| 2805 |
baseUrl, err := url.Parse(c.endpoint) |
| 2806 |
if err != nil { |
| 2807 |
return nil, "", err |
| 2808 |
} |
| 2809 |
baseUrl.Path += fmt.Sprintf("/v1/%v:listRevisions", req.GetName()) |
| 2810 |
|
| 2811 |
params := url.Values{} |
| 2812 |
params.Add("$alt", "json;enum-encoding=int") |
| 2813 |
if req.GetPageSize() != 0 { |
| 2814 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 2815 |
} |
| 2816 |
if req.GetPageToken() != "" { |
| 2817 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 2818 |
} |
| 2819 |
|
| 2820 |
baseUrl.RawQuery = params.Encode() |
| 2821 |
|
| 2822 |
|
| 2823 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 2824 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2825 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2826 |
if settings.Path != "" { |
| 2827 |
baseUrl.Path = settings.Path |
| 2828 |
} |
| 2829 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 2830 |
if err != nil { |
| 2831 |
return err |
| 2832 |
} |
| 2833 |
httpReq.Header = headers |
| 2834 |
|
| 2835 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListBlueprintRevisions") |
| 2836 |
if err != nil { |
| 2837 |
return err |
| 2838 |
} |
| 2839 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2840 |
return err |
| 2841 |
} |
| 2842 |
|
| 2843 |
return nil |
| 2844 |
}, opts...) |
| 2845 |
if e != nil { |
| 2846 |
return nil, "", e |
| 2847 |
} |
| 2848 |
it.Response = resp |
| 2849 |
return resp.GetBlueprints(), resp.GetNextPageToken(), nil |
| 2850 |
} |
| 2851 |
|
| 2852 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 2853 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 2854 |
if err != nil { |
| 2855 |
return "", err |
| 2856 |
} |
| 2857 |
it.items = append(it.items, items...) |
| 2858 |
return nextPageToken, nil |
| 2859 |
} |
| 2860 |
|
| 2861 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 2862 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 2863 |
it.pageInfo.Token = req.GetPageToken() |
| 2864 |
|
| 2865 |
return it |
| 2866 |
} |
| 2867 |
|
| 2868 |
|
| 2869 |
func (c *restClient) SearchBlueprintRevisions(ctx context.Context, req *telcoautomationpb.SearchBlueprintRevisionsRequest, opts ...gax.CallOption) *BlueprintIterator { |
| 2870 |
it := &BlueprintIterator{} |
| 2871 |
req = proto.Clone(req).(*telcoautomationpb.SearchBlueprintRevisionsRequest) |
| 2872 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2873 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.Blueprint, string, error) { |
| 2874 |
resp := &telcoautomationpb.SearchBlueprintRevisionsResponse{} |
| 2875 |
if pageToken != "" { |
| 2876 |
req.PageToken = pageToken |
| 2877 |
} |
| 2878 |
if pageSize > math.MaxInt32 { |
| 2879 |
req.PageSize = math.MaxInt32 |
| 2880 |
} else if pageSize != 0 { |
| 2881 |
req.PageSize = int32(pageSize) |
| 2882 |
} |
| 2883 |
baseUrl, err := url.Parse(c.endpoint) |
| 2884 |
if err != nil { |
| 2885 |
return nil, "", err |
| 2886 |
} |
| 2887 |
baseUrl.Path += fmt.Sprintf("/v1/%v/blueprints:searchRevisions", req.GetParent()) |
| 2888 |
|
| 2889 |
params := url.Values{} |
| 2890 |
params.Add("$alt", "json;enum-encoding=int") |
| 2891 |
if req.GetPageSize() != 0 { |
| 2892 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 2893 |
} |
| 2894 |
if req.GetPageToken() != "" { |
| 2895 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 2896 |
} |
| 2897 |
params.Add("query", fmt.Sprintf("%v", req.GetQuery())) |
| 2898 |
|
| 2899 |
baseUrl.RawQuery = params.Encode() |
| 2900 |
|
| 2901 |
|
| 2902 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 2903 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2904 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2905 |
if settings.Path != "" { |
| 2906 |
baseUrl.Path = settings.Path |
| 2907 |
} |
| 2908 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 2909 |
if err != nil { |
| 2910 |
return err |
| 2911 |
} |
| 2912 |
httpReq.Header = headers |
| 2913 |
|
| 2914 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "SearchBlueprintRevisions") |
| 2915 |
if err != nil { |
| 2916 |
return err |
| 2917 |
} |
| 2918 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2919 |
return err |
| 2920 |
} |
| 2921 |
|
| 2922 |
return nil |
| 2923 |
}, opts...) |
| 2924 |
if e != nil { |
| 2925 |
return nil, "", e |
| 2926 |
} |
| 2927 |
it.Response = resp |
| 2928 |
return resp.GetBlueprints(), resp.GetNextPageToken(), nil |
| 2929 |
} |
| 2930 |
|
| 2931 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 2932 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 2933 |
if err != nil { |
| 2934 |
return "", err |
| 2935 |
} |
| 2936 |
it.items = append(it.items, items...) |
| 2937 |
return nextPageToken, nil |
| 2938 |
} |
| 2939 |
|
| 2940 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 2941 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 2942 |
it.pageInfo.Token = req.GetPageToken() |
| 2943 |
|
| 2944 |
return it |
| 2945 |
} |
| 2946 |
|
| 2947 |
|
| 2948 |
func (c *restClient) SearchDeploymentRevisions(ctx context.Context, req *telcoautomationpb.SearchDeploymentRevisionsRequest, opts ...gax.CallOption) *DeploymentIterator { |
| 2949 |
it := &DeploymentIterator{} |
| 2950 |
req = proto.Clone(req).(*telcoautomationpb.SearchDeploymentRevisionsRequest) |
| 2951 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 2952 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.Deployment, string, error) { |
| 2953 |
resp := &telcoautomationpb.SearchDeploymentRevisionsResponse{} |
| 2954 |
if pageToken != "" { |
| 2955 |
req.PageToken = pageToken |
| 2956 |
} |
| 2957 |
if pageSize > math.MaxInt32 { |
| 2958 |
req.PageSize = math.MaxInt32 |
| 2959 |
} else if pageSize != 0 { |
| 2960 |
req.PageSize = int32(pageSize) |
| 2961 |
} |
| 2962 |
baseUrl, err := url.Parse(c.endpoint) |
| 2963 |
if err != nil { |
| 2964 |
return nil, "", err |
| 2965 |
} |
| 2966 |
baseUrl.Path += fmt.Sprintf("/v1/%v/deployments:searchRevisions", req.GetParent()) |
| 2967 |
|
| 2968 |
params := url.Values{} |
| 2969 |
params.Add("$alt", "json;enum-encoding=int") |
| 2970 |
if req.GetPageSize() != 0 { |
| 2971 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 2972 |
} |
| 2973 |
if req.GetPageToken() != "" { |
| 2974 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 2975 |
} |
| 2976 |
params.Add("query", fmt.Sprintf("%v", req.GetQuery())) |
| 2977 |
|
| 2978 |
baseUrl.RawQuery = params.Encode() |
| 2979 |
|
| 2980 |
|
| 2981 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 2982 |
headers := gax.BuildHeaders(ctx, hds...) |
| 2983 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 2984 |
if settings.Path != "" { |
| 2985 |
baseUrl.Path = settings.Path |
| 2986 |
} |
| 2987 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 2988 |
if err != nil { |
| 2989 |
return err |
| 2990 |
} |
| 2991 |
httpReq.Header = headers |
| 2992 |
|
| 2993 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "SearchDeploymentRevisions") |
| 2994 |
if err != nil { |
| 2995 |
return err |
| 2996 |
} |
| 2997 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 2998 |
return err |
| 2999 |
} |
| 3000 |
|
| 3001 |
return nil |
| 3002 |
}, opts...) |
| 3003 |
if e != nil { |
| 3004 |
return nil, "", e |
| 3005 |
} |
| 3006 |
it.Response = resp |
| 3007 |
return resp.GetDeployments(), resp.GetNextPageToken(), nil |
| 3008 |
} |
| 3009 |
|
| 3010 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 3011 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 3012 |
if err != nil { |
| 3013 |
return "", err |
| 3014 |
} |
| 3015 |
it.items = append(it.items, items...) |
| 3016 |
return nextPageToken, nil |
| 3017 |
} |
| 3018 |
|
| 3019 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 3020 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 3021 |
it.pageInfo.Token = req.GetPageToken() |
| 3022 |
|
| 3023 |
return it |
| 3024 |
} |
| 3025 |
|
| 3026 |
|
| 3027 |
|
| 3028 |
|
| 3029 |
func (c *restClient) DiscardBlueprintChanges(ctx context.Context, req *telcoautomationpb.DiscardBlueprintChangesRequest, opts ...gax.CallOption) (*telcoautomationpb.DiscardBlueprintChangesResponse, error) { |
| 3030 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 3031 |
jsonReq, err := m.Marshal(req) |
| 3032 |
if err != nil { |
| 3033 |
return nil, err |
| 3034 |
} |
| 3035 |
|
| 3036 |
baseUrl, err := url.Parse(c.endpoint) |
| 3037 |
if err != nil { |
| 3038 |
return nil, err |
| 3039 |
} |
| 3040 |
baseUrl.Path += fmt.Sprintf("/v1/%v:discard", req.GetName()) |
| 3041 |
|
| 3042 |
params := url.Values{} |
| 3043 |
params.Add("$alt", "json;enum-encoding=int") |
| 3044 |
|
| 3045 |
baseUrl.RawQuery = params.Encode() |
| 3046 |
|
| 3047 |
|
| 3048 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 3049 |
|
| 3050 |
hds = append(c.xGoogHeaders, hds...) |
| 3051 |
hds = append(hds, "Content-Type", "application/json") |
| 3052 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3053 |
opts = append((*c.CallOptions).DiscardBlueprintChanges[0:len((*c.CallOptions).DiscardBlueprintChanges):len((*c.CallOptions).DiscardBlueprintChanges)], opts...) |
| 3054 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3055 |
resp := &telcoautomationpb.DiscardBlueprintChangesResponse{} |
| 3056 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3057 |
if settings.Path != "" { |
| 3058 |
baseUrl.Path = settings.Path |
| 3059 |
} |
| 3060 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 3061 |
if err != nil { |
| 3062 |
return err |
| 3063 |
} |
| 3064 |
httpReq = httpReq.WithContext(ctx) |
| 3065 |
httpReq.Header = headers |
| 3066 |
|
| 3067 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "DiscardBlueprintChanges") |
| 3068 |
if err != nil { |
| 3069 |
return err |
| 3070 |
} |
| 3071 |
|
| 3072 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3073 |
return err |
| 3074 |
} |
| 3075 |
|
| 3076 |
return nil |
| 3077 |
}, opts...) |
| 3078 |
if e != nil { |
| 3079 |
return nil, e |
| 3080 |
} |
| 3081 |
return resp, nil |
| 3082 |
} |
| 3083 |
|
| 3084 |
0, |
| 3085 |
|
| 3086 |
func (c *restClient) ListPublicBlueprints(ctx context.Context, req *telcoautomationpb.ListPublicBlueprintsRequest, opts ...gax.CallOption) *PublicBlueprintIterator { |
| 3087 |
it := &PublicBlueprintIterator{} |
| 3088 |
req = proto.Clone(req).(*telcoautomationpb.ListPublicBlueprintsRequest) |
| 3089 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3090 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.PublicBlueprint, string, error) { |
| 3091 |
resp := &telcoautomationpb.ListPublicBlueprintsResponse{} |
| 3092 |
if pageToken != "" { |
| 3093 |
req.PageToken = pageToken |
| 3094 |
} |
| 3095 |
if pageSize > math.MaxInt32 { |
| 3096 |
req.PageSize = math.MaxInt32 |
| 3097 |
} else if pageSize != 0 { |
| 3098 |
req.PageSize = int32(pageSize) |
| 3099 |
} |
| 3100 |
baseUrl, err := url.Parse(c.endpoint) |
| 3101 |
if err != nil { |
| 3102 |
return nil, "", err |
| 3103 |
} |
| 3104 |
baseUrl.Path += fmt.Sprintf("/v1/%v/publicBlueprints", req.GetParent()) |
| 3105 |
|
| 3106 |
params := url.Values{} |
| 3107 |
params.Add("$alt", "json;enum-encoding=int") |
| 3108 |
if req.GetPageSize() != 0 { |
| 3109 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 3110 |
} |
| 3111 |
if req.GetPageToken() != "" { |
| 3112 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 3113 |
} |
| 3114 |
|
| 3115 |
baseUrl.RawQuery = params.Encode() |
| 3116 |
|
| 3117 |
|
| 3118 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 3119 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3120 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3121 |
if settings.Path != "" { |
| 3122 |
baseUrl.Path = settings.Path |
| 3123 |
} |
| 3124 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 3125 |
if err != nil { |
| 3126 |
return err |
| 3127 |
} |
| 3128 |
httpReq.Header = headers |
| 3129 |
|
| 3130 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListPublicBlueprints") |
| 3131 |
if err != nil { |
| 3132 |
return err |
| 3133 |
} |
| 3134 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3135 |
return err |
| 3136 |
} |
| 3137 |
|
| 3138 |
return nil |
| 3139 |
}, opts...) |
| 3140 |
if e != nil { |
| 3141 |
return nil, "", e |
| 3142 |
} |
| 3143 |
it.Response = resp |
| 3144 |
return resp.GetPublicBlueprints(), resp.GetNextPageToken(), nil |
| 3145 |
} |
| 3146 |
|
| 3147 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 3148 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 3149 |
if err != nil { |
| 3150 |
return "", err |
| 3151 |
} |
| 3152 |
it.items = append(it.items, items...) |
| 3153 |
return nextPageToken, nil |
| 3154 |
} |
| 3155 |
|
| 3156 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 3157 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 3158 |
it.pageInfo.Token = req.GetPageToken() |
| 3159 |
|
| 3160 |
return it |
| 3161 |
} |
| 3162 |
|
| 3163 |
|
| 3164 |
func (c *restClient) GetPublicBlueprint(ctx context.Context, req *telcoautomationpb.GetPublicBlueprintRequest, opts ...gax.CallOption) (*telcoautomationpb.PublicBlueprint, error) { |
| 3165 |
baseUrl, err := url.Parse(c.endpoint) |
| 3166 |
if err != nil { |
| 3167 |
return nil, err |
| 3168 |
} |
| 3169 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 3170 |
|
| 3171 |
params := url.Values{} |
| 3172 |
params.Add("$alt", "json;enum-encoding=int") |
| 3173 |
|
| 3174 |
baseUrl.RawQuery = params.Encode() |
| 3175 |
|
| 3176 |
|
| 3177 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 3178 |
|
| 3179 |
hds = append(c.xGoogHeaders, hds...) |
| 3180 |
hds = append(hds, "Content-Type", "application/json") |
| 3181 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3182 |
opts = append((*c.CallOptions).GetPublicBlueprint[0:len((*c.CallOptions).GetPublicBlueprint):len((*c.CallOptions).GetPublicBlueprint)], opts...) |
| 3183 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3184 |
resp := &telcoautomationpb.PublicBlueprint{} |
| 3185 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3186 |
if settings.Path != "" { |
| 3187 |
baseUrl.Path = settings.Path |
| 3188 |
} |
| 3189 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 3190 |
if err != nil { |
| 3191 |
return err |
| 3192 |
} |
| 3193 |
httpReq = httpReq.WithContext(ctx) |
| 3194 |
httpReq.Header = headers |
| 3195 |
|
| 3196 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetPublicBlueprint") |
| 3197 |
if err != nil { |
| 3198 |
return err |
| 3199 |
} |
| 3200 |
|
| 3201 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3202 |
return err |
| 3203 |
} |
| 3204 |
|
| 3205 |
return nil |
| 3206 |
}, opts...) |
| 3207 |
if e != nil { |
| 3208 |
return nil, e |
| 3209 |
} |
| 3210 |
return resp, nil |
| 3211 |
} |
| 3212 |
|
| 3213 |
|
| 3214 |
func (c *restClient) CreateDeployment(ctx context.Context, req *telcoautomationpb.CreateDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 3215 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 3216 |
body := req.GetDeployment() |
| 3217 |
jsonReq, err := m.Marshal(body) |
| 3218 |
if err != nil { |
| 3219 |
return nil, err |
| 3220 |
} |
| 3221 |
|
| 3222 |
baseUrl, err := url.Parse(c.endpoint) |
| 3223 |
if err != nil { |
| 3224 |
return nil, err |
| 3225 |
} |
| 3226 |
baseUrl.Path += fmt.Sprintf("/v1/%v/deployments", req.GetParent()) |
| 3227 |
|
| 3228 |
params := url.Values{} |
| 3229 |
params.Add("$alt", "json;enum-encoding=int") |
| 3230 |
if req.GetDeploymentId() != "" { |
| 3231 |
params.Add("deploymentId", fmt.Sprintf("%v", req.GetDeploymentId())) |
| 3232 |
} |
| 3233 |
|
| 3234 |
baseUrl.RawQuery = params.Encode() |
| 3235 |
|
| 3236 |
|
| 3237 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))} |
| 3238 |
|
| 3239 |
hds = append(c.xGoogHeaders, hds...) |
| 3240 |
hds = append(hds, "Content-Type", "application/json") |
| 3241 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3242 |
opts = append((*c.CallOptions).CreateDeployment[0:len((*c.CallOptions).CreateDeployment):len((*c.CallOptions).CreateDeployment)], opts...) |
| 3243 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3244 |
resp := &telcoautomationpb.Deployment{} |
| 3245 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3246 |
if settings.Path != "" { |
| 3247 |
baseUrl.Path = settings.Path |
| 3248 |
} |
| 3249 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 3250 |
if err != nil { |
| 3251 |
return err |
| 3252 |
} |
| 3253 |
httpReq = httpReq.WithContext(ctx) |
| 3254 |
httpReq.Header = headers |
| 3255 |
|
| 3256 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CreateDeployment") |
| 3257 |
if err != nil { |
| 3258 |
return err |
| 3259 |
} |
| 3260 |
|
| 3261 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3262 |
return err |
| 3263 |
} |
| 3264 |
|
| 3265 |
return nil |
| 3266 |
}, opts...) |
| 3267 |
if e != nil { |
| 3268 |
return nil, e |
| 3269 |
} |
| 3270 |
return resp, nil |
| 3271 |
} |
| 3272 |
|
| 3273 |
|
| 3274 |
func (c *restClient) UpdateDeployment(ctx context.Context, req *telcoautomationpb.UpdateDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 3275 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 3276 |
body := req.GetDeployment() |
| 3277 |
jsonReq, err := m.Marshal(body) |
| 3278 |
if err != nil { |
| 3279 |
return nil, err |
| 3280 |
} |
| 3281 |
|
| 3282 |
baseUrl, err := url.Parse(c.endpoint) |
| 3283 |
if err != nil { |
| 3284 |
return nil, err |
| 3285 |
} |
| 3286 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetDeployment().GetName()) |
| 3287 |
|
| 3288 |
params := url.Values{} |
| 3289 |
params.Add("$alt", "json;enum-encoding=int") |
| 3290 |
if req.GetUpdateMask() != nil { |
| 3291 |
field, err := protojson.Marshal(req.GetUpdateMask()) |
| 3292 |
if err != nil { |
| 3293 |
return nil, err |
| 3294 |
} |
| 3295 |
params.Add("updateMask", string(field[1:len(field)-1])) |
| 3296 |
} |
| 3297 |
|
| 3298 |
baseUrl.RawQuery = params.Encode() |
| 3299 |
|
| 3300 |
|
| 3301 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "deployment.name", url.QueryEscape(req.GetDeployment().GetName()))} |
| 3302 |
|
| 3303 |
hds = append(c.xGoogHeaders, hds...) |
| 3304 |
hds = append(hds, "Content-Type", "application/json") |
| 3305 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3306 |
opts = append((*c.CallOptions).UpdateDeployment[0:len((*c.CallOptions).UpdateDeployment):len((*c.CallOptions).UpdateDeployment)], opts...) |
| 3307 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3308 |
resp := &telcoautomationpb.Deployment{} |
| 3309 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3310 |
if settings.Path != "" { |
| 3311 |
baseUrl.Path = settings.Path |
| 3312 |
} |
| 3313 |
httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 3314 |
if err != nil { |
| 3315 |
return err |
| 3316 |
} |
| 3317 |
httpReq = httpReq.WithContext(ctx) |
| 3318 |
httpReq.Header = headers |
| 3319 |
|
| 3320 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateDeployment") |
| 3321 |
if err != nil { |
| 3322 |
return err |
| 3323 |
} |
| 3324 |
|
| 3325 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3326 |
return err |
| 3327 |
} |
| 3328 |
|
| 3329 |
return nil |
| 3330 |
}, opts...) |
| 3331 |
if e != nil { |
| 3332 |
return nil, e |
| 3333 |
} |
| 3334 |
return resp, nil |
| 3335 |
} |
| 3336 |
|
| 3337 |
|
| 3338 |
func (c *restClient) GetDeployment(ctx context.Context, req *telcoautomationpb.GetDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 3339 |
baseUrl, err := url.Parse(c.endpoint) |
| 3340 |
if err != nil { |
| 3341 |
return nil, err |
| 3342 |
} |
| 3343 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 3344 |
|
| 3345 |
params := url.Values{} |
| 3346 |
params.Add("$alt", "json;enum-encoding=int") |
| 3347 |
if req.GetView() != 0 { |
| 3348 |
params.Add("view", fmt.Sprintf("%v", req.GetView())) |
| 3349 |
} |
| 3350 |
|
| 3351 |
baseUrl.RawQuery = params.Encode() |
| 3352 |
|
| 3353 |
|
| 3354 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 3355 |
|
| 3356 |
hds = append(c.xGoogHeaders, hds...) |
| 3357 |
hds = append(hds, "Content-Type", "application/json") |
| 3358 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3359 |
opts = append((*c.CallOptions).GetDeployment[0:len((*c.CallOptions).GetDeployment):len((*c.CallOptions).GetDeployment)], opts...) |
| 3360 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3361 |
resp := &telcoautomationpb.Deployment{} |
| 3362 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3363 |
if settings.Path != "" { |
| 3364 |
baseUrl.Path = settings.Path |
| 3365 |
} |
| 3366 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 3367 |
if err != nil { |
| 3368 |
return err |
| 3369 |
} |
| 3370 |
httpReq = httpReq.WithContext(ctx) |
| 3371 |
httpReq.Header = headers |
| 3372 |
|
| 3373 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetDeployment") |
| 3374 |
if err != nil { |
| 3375 |
return err |
| 3376 |
} |
| 3377 |
|
| 3378 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3379 |
return err |
| 3380 |
} |
| 3381 |
|
| 3382 |
return nil |
| 3383 |
}, opts...) |
| 3384 |
if e != nil { |
| 3385 |
return nil, e |
| 3386 |
} |
| 3387 |
return resp, nil |
| 3388 |
} |
| 3389 |
|
| 3390 |
|
| 3391 |
d. |
| 3392 |
func (c *restClient) RemoveDeployment(ctx context.Context, req *telcoautomationpb.RemoveDeploymentRequest, opts ...gax.CallOption) error { |
| 3393 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 3394 |
jsonReq, err := m.Marshal(req) |
| 3395 |
if err != nil { |
| 3396 |
return err |
| 3397 |
} |
| 3398 |
|
| 3399 |
baseUrl, err := url.Parse(c.endpoint) |
| 3400 |
if err != nil { |
| 3401 |
return err |
| 3402 |
} |
| 3403 |
baseUrl.Path += fmt.Sprintf("/v1/%v:remove", req.GetName()) |
| 3404 |
|
| 3405 |
params := url.Values{} |
| 3406 |
params.Add("$alt", "json;enum-encoding=int") |
| 3407 |
|
| 3408 |
baseUrl.RawQuery = params.Encode() |
| 3409 |
|
| 3410 |
|
| 3411 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 3412 |
|
| 3413 |
hds = append(c.xGoogHeaders, hds...) |
| 3414 |
hds = append(hds, "Content-Type", "application/json") |
| 3415 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3416 |
return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3417 |
if settings.Path != "" { |
| 3418 |
baseUrl.Path = settings.Path |
| 3419 |
} |
| 3420 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 3421 |
if err != nil { |
| 3422 |
return err |
| 3423 |
} |
| 3424 |
httpReq = httpReq.WithContext(ctx) |
| 3425 |
httpReq.Header = headers |
| 3426 |
|
| 3427 |
_, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "RemoveDeployment") |
| 3428 |
return err |
| 3429 |
}, opts...) |
| 3430 |
} |
| 3431 |
|
| 3432 |
|
| 3433 |
func (c *restClient) ListDeployments(ctx context.Context, req *telcoautomationpb.ListDeploymentsRequest, opts ...gax.CallOption) *DeploymentIterator { |
| 3434 |
it := &DeploymentIterator{} |
| 3435 |
req = proto.Clone(req).(*telcoautomationpb.ListDeploymentsRequest) |
| 3436 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3437 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.Deployment, string, error) { |
| 3438 |
resp := &telcoautomationpb.ListDeploymentsResponse{} |
| 3439 |
if pageToken != "" { |
| 3440 |
req.PageToken = pageToken |
| 3441 |
} |
| 3442 |
if pageSize > math.MaxInt32 { |
| 3443 |
req.PageSize = math.MaxInt32 |
| 3444 |
} else if pageSize != 0 { |
| 3445 |
req.PageSize = int32(pageSize) |
| 3446 |
} |
| 3447 |
baseUrl, err := url.Parse(c.endpoint) |
| 3448 |
if err != nil { |
| 3449 |
return nil, "", err |
| 3450 |
} |
| 3451 |
baseUrl.Path += fmt.Sprintf("/v1/%v/deployments", req.GetParent()) |
| 3452 |
|
| 3453 |
params := url.Values{} |
| 3454 |
params.Add("$alt", "json;enum-encoding=int") |
| 3455 |
if req.GetFilter() != "" { |
| 3456 |
params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) |
| 3457 |
} |
| 3458 |
if req.GetPageSize() != 0 { |
| 3459 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 3460 |
} |
| 3461 |
if req.GetPageToken() != "" { |
| 3462 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 3463 |
} |
| 3464 |
|
| 3465 |
baseUrl.RawQuery = params.Encode() |
| 3466 |
|
| 3467 |
|
| 3468 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 3469 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3470 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3471 |
if settings.Path != "" { |
| 3472 |
baseUrl.Path = settings.Path |
| 3473 |
} |
| 3474 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 3475 |
if err != nil { |
| 3476 |
return err |
| 3477 |
} |
| 3478 |
httpReq.Header = headers |
| 3479 |
|
| 3480 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListDeployments") |
| 3481 |
if err != nil { |
| 3482 |
return err |
| 3483 |
} |
| 3484 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3485 |
return err |
| 3486 |
} |
| 3487 |
|
| 3488 |
return nil |
| 3489 |
}, opts...) |
| 3490 |
if e != nil { |
| 3491 |
return nil, "", e |
| 3492 |
} |
| 3493 |
it.Response = resp |
| 3494 |
return resp.GetDeployments(), resp.GetNextPageToken(), nil |
| 3495 |
} |
| 3496 |
|
| 3497 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 3498 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 3499 |
if err != nil { |
| 3500 |
return "", err |
| 3501 |
} |
| 3502 |
it.items = append(it.items, items...) |
| 3503 |
return nextPageToken, nil |
| 3504 |
} |
| 3505 |
|
| 3506 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 3507 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 3508 |
it.pageInfo.Token = req.GetPageToken() |
| 3509 |
|
| 3510 |
return it |
| 3511 |
} |
| 3512 |
|
| 3513 |
|
| 3514 |
func (c *restClient) ListDeploymentRevisions(ctx context.Context, req *telcoautomationpb.ListDeploymentRevisionsRequest, opts ...gax.CallOption) *DeploymentIterator { |
| 3515 |
it := &DeploymentIterator{} |
| 3516 |
req = proto.Clone(req).(*telcoautomationpb.ListDeploymentRevisionsRequest) |
| 3517 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3518 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.Deployment, string, error) { |
| 3519 |
resp := &telcoautomationpb.ListDeploymentRevisionsResponse{} |
| 3520 |
if pageToken != "" { |
| 3521 |
req.PageToken = pageToken |
| 3522 |
} |
| 3523 |
if pageSize > math.MaxInt32 { |
| 3524 |
req.PageSize = math.MaxInt32 |
| 3525 |
} else if pageSize != 0 { |
| 3526 |
req.PageSize = int32(pageSize) |
| 3527 |
} |
| 3528 |
baseUrl, err := url.Parse(c.endpoint) |
| 3529 |
if err != nil { |
| 3530 |
return nil, "", err |
| 3531 |
} |
| 3532 |
baseUrl.Path += fmt.Sprintf("/v1/%v:listRevisions", req.GetName()) |
| 3533 |
|
| 3534 |
params := url.Values{} |
| 3535 |
params.Add("$alt", "json;enum-encoding=int") |
| 3536 |
if req.GetPageSize() != 0 { |
| 3537 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 3538 |
} |
| 3539 |
if req.GetPageToken() != "" { |
| 3540 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 3541 |
} |
| 3542 |
|
| 3543 |
baseUrl.RawQuery = params.Encode() |
| 3544 |
|
| 3545 |
|
| 3546 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 3547 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3548 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3549 |
if settings.Path != "" { |
| 3550 |
baseUrl.Path = settings.Path |
| 3551 |
} |
| 3552 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 3553 |
if err != nil { |
| 3554 |
return err |
| 3555 |
} |
| 3556 |
httpReq.Header = headers |
| 3557 |
|
| 3558 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListDeploymentRevisions") |
| 3559 |
if err != nil { |
| 3560 |
return err |
| 3561 |
} |
| 3562 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3563 |
return err |
| 3564 |
} |
| 3565 |
|
| 3566 |
return nil |
| 3567 |
}, opts...) |
| 3568 |
if e != nil { |
| 3569 |
return nil, "", e |
| 3570 |
} |
| 3571 |
it.Response = resp |
| 3572 |
return resp.GetDeployments(), resp.GetNextPageToken(), nil |
| 3573 |
} |
| 3574 |
|
| 3575 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 3576 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 3577 |
if err != nil { |
| 3578 |
return "", err |
| 3579 |
} |
| 3580 |
it.items = append(it.items, items...) |
| 3581 |
return nextPageToken, nil |
| 3582 |
} |
| 3583 |
|
| 3584 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 3585 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 3586 |
it.pageInfo.Token = req.GetPageToken() |
| 3587 |
|
| 3588 |
return it |
| 3589 |
} |
| 3590 |
|
| 3591 |
|
| 3592 |
|
| 3593 |
|
| 3594 |
func (c *restClient) DiscardDeploymentChanges(ctx context.Context, req *telcoautomationpb.DiscardDeploymentChangesRequest, opts ...gax.CallOption) (*telcoautomationpb.DiscardDeploymentChangesResponse, error) { |
| 3595 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 3596 |
jsonReq, err := m.Marshal(req) |
| 3597 |
if err != nil { |
| 3598 |
return nil, err |
| 3599 |
} |
| 3600 |
|
| 3601 |
baseUrl, err := url.Parse(c.endpoint) |
| 3602 |
if err != nil { |
| 3603 |
return nil, err |
| 3604 |
} |
| 3605 |
baseUrl.Path += fmt.Sprintf("/v1/%v:discard", req.GetName()) |
| 3606 |
|
| 3607 |
params := url.Values{} |
| 3608 |
params.Add("$alt", "json;enum-encoding=int") |
| 3609 |
|
| 3610 |
baseUrl.RawQuery = params.Encode() |
| 3611 |
|
| 3612 |
|
| 3613 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 3614 |
|
| 3615 |
hds = append(c.xGoogHeaders, hds...) |
| 3616 |
hds = append(hds, "Content-Type", "application/json") |
| 3617 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3618 |
opts = append((*c.CallOptions).DiscardDeploymentChanges[0:len((*c.CallOptions).DiscardDeploymentChanges):len((*c.CallOptions).DiscardDeploymentChanges)], opts...) |
| 3619 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3620 |
resp := &telcoautomationpb.DiscardDeploymentChangesResponse{} |
| 3621 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3622 |
if settings.Path != "" { |
| 3623 |
baseUrl.Path = settings.Path |
| 3624 |
} |
| 3625 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 3626 |
if err != nil { |
| 3627 |
return err |
| 3628 |
} |
| 3629 |
httpReq = httpReq.WithContext(ctx) |
| 3630 |
httpReq.Header = headers |
| 3631 |
|
| 3632 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "DiscardDeploymentChanges") |
| 3633 |
if err != nil { |
| 3634 |
return err |
| 3635 |
} |
| 3636 |
|
| 3637 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3638 |
return err |
| 3639 |
} |
| 3640 |
|
| 3641 |
return nil |
| 3642 |
}, opts...) |
| 3643 |
if e != nil { |
| 3644 |
return nil, e |
| 3645 |
} |
| 3646 |
return resp, nil |
| 3647 |
} |
| 3648 |
|
| 3649 |
r. |
| 3650 |
func (c *restClient) ApplyDeployment(ctx context.Context, req *telcoautomationpb.ApplyDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 3651 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 3652 |
jsonReq, err := m.Marshal(req) |
| 3653 |
if err != nil { |
| 3654 |
return nil, err |
| 3655 |
} |
| 3656 |
|
| 3657 |
baseUrl, err := url.Parse(c.endpoint) |
| 3658 |
if err != nil { |
| 3659 |
return nil, err |
| 3660 |
} |
| 3661 |
baseUrl.Path += fmt.Sprintf("/v1/%v:apply", req.GetName()) |
| 3662 |
|
| 3663 |
params := url.Values{} |
| 3664 |
params.Add("$alt", "json;enum-encoding=int") |
| 3665 |
|
| 3666 |
baseUrl.RawQuery = params.Encode() |
| 3667 |
|
| 3668 |
|
| 3669 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 3670 |
|
| 3671 |
hds = append(c.xGoogHeaders, hds...) |
| 3672 |
hds = append(hds, "Content-Type", "application/json") |
| 3673 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3674 |
opts = append((*c.CallOptions).ApplyDeployment[0:len((*c.CallOptions).ApplyDeployment):len((*c.CallOptions).ApplyDeployment)], opts...) |
| 3675 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3676 |
resp := &telcoautomationpb.Deployment{} |
| 3677 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3678 |
if settings.Path != "" { |
| 3679 |
baseUrl.Path = settings.Path |
| 3680 |
} |
| 3681 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 3682 |
if err != nil { |
| 3683 |
return err |
| 3684 |
} |
| 3685 |
httpReq = httpReq.WithContext(ctx) |
| 3686 |
httpReq.Header = headers |
| 3687 |
|
| 3688 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ApplyDeployment") |
| 3689 |
if err != nil { |
| 3690 |
return err |
| 3691 |
} |
| 3692 |
|
| 3693 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3694 |
return err |
| 3695 |
} |
| 3696 |
|
| 3697 |
return nil |
| 3698 |
}, opts...) |
| 3699 |
if e != nil { |
| 3700 |
return nil, e |
| 3701 |
} |
| 3702 |
return resp, nil |
| 3703 |
} |
| 3704 |
|
| 3705 |
|
| 3706 |
func (c *restClient) ComputeDeploymentStatus(ctx context.Context, req *telcoautomationpb.ComputeDeploymentStatusRequest, opts ...gax.CallOption) (*telcoautomationpb.ComputeDeploymentStatusResponse, error) { |
| 3707 |
baseUrl, err := url.Parse(c.endpoint) |
| 3708 |
if err != nil { |
| 3709 |
return nil, err |
| 3710 |
} |
| 3711 |
baseUrl.Path += fmt.Sprintf("/v1/%v:computeDeploymentStatus", req.GetName()) |
| 3712 |
|
| 3713 |
params := url.Values{} |
| 3714 |
params.Add("$alt", "json;enum-encoding=int") |
| 3715 |
|
| 3716 |
baseUrl.RawQuery = params.Encode() |
| 3717 |
|
| 3718 |
|
| 3719 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 3720 |
|
| 3721 |
hds = append(c.xGoogHeaders, hds...) |
| 3722 |
hds = append(hds, "Content-Type", "application/json") |
| 3723 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3724 |
opts = append((*c.CallOptions).ComputeDeploymentStatus[0:len((*c.CallOptions).ComputeDeploymentStatus):len((*c.CallOptions).ComputeDeploymentStatus)], opts...) |
| 3725 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3726 |
resp := &telcoautomationpb.ComputeDeploymentStatusResponse{} |
| 3727 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3728 |
if settings.Path != "" { |
| 3729 |
baseUrl.Path = settings.Path |
| 3730 |
} |
| 3731 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 3732 |
if err != nil { |
| 3733 |
return err |
| 3734 |
} |
| 3735 |
httpReq = httpReq.WithContext(ctx) |
| 3736 |
httpReq.Header = headers |
| 3737 |
|
| 3738 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ComputeDeploymentStatus") |
| 3739 |
if err != nil { |
| 3740 |
return err |
| 3741 |
} |
| 3742 |
|
| 3743 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3744 |
return err |
| 3745 |
} |
| 3746 |
|
| 3747 |
return nil |
| 3748 |
}, opts...) |
| 3749 |
if e != nil { |
| 3750 |
return nil, e |
| 3751 |
} |
| 3752 |
return resp, nil |
| 3753 |
} |
| 3754 |
|
| 3755 |
|
| 3756 |
|
| 3757 |
func (c *restClient) RollbackDeployment(ctx context.Context, req *telcoautomationpb.RollbackDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.Deployment, error) { |
| 3758 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 3759 |
jsonReq, err := m.Marshal(req) |
| 3760 |
if err != nil { |
| 3761 |
return nil, err |
| 3762 |
} |
| 3763 |
|
| 3764 |
baseUrl, err := url.Parse(c.endpoint) |
| 3765 |
if err != nil { |
| 3766 |
return nil, err |
| 3767 |
} |
| 3768 |
baseUrl.Path += fmt.Sprintf("/v1/%v:rollback", req.GetName()) |
| 3769 |
|
| 3770 |
params := url.Values{} |
| 3771 |
params.Add("$alt", "json;enum-encoding=int") |
| 3772 |
|
| 3773 |
baseUrl.RawQuery = params.Encode() |
| 3774 |
|
| 3775 |
|
| 3776 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 3777 |
|
| 3778 |
hds = append(c.xGoogHeaders, hds...) |
| 3779 |
hds = append(hds, "Content-Type", "application/json") |
| 3780 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3781 |
opts = append((*c.CallOptions).RollbackDeployment[0:len((*c.CallOptions).RollbackDeployment):len((*c.CallOptions).RollbackDeployment)], opts...) |
| 3782 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3783 |
resp := &telcoautomationpb.Deployment{} |
| 3784 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3785 |
if settings.Path != "" { |
| 3786 |
baseUrl.Path = settings.Path |
| 3787 |
} |
| 3788 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 3789 |
if err != nil { |
| 3790 |
return err |
| 3791 |
} |
| 3792 |
httpReq = httpReq.WithContext(ctx) |
| 3793 |
httpReq.Header = headers |
| 3794 |
|
| 3795 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "RollbackDeployment") |
| 3796 |
if err != nil { |
| 3797 |
return err |
| 3798 |
} |
| 3799 |
|
| 3800 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3801 |
return err |
| 3802 |
} |
| 3803 |
|
| 3804 |
return nil |
| 3805 |
}, opts...) |
| 3806 |
if e != nil { |
| 3807 |
return nil, e |
| 3808 |
} |
| 3809 |
return resp, nil |
| 3810 |
} |
| 3811 |
|
| 3812 |
|
| 3813 |
func (c *restClient) GetHydratedDeployment(ctx context.Context, req *telcoautomationpb.GetHydratedDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.HydratedDeployment, error) { |
| 3814 |
baseUrl, err := url.Parse(c.endpoint) |
| 3815 |
if err != nil { |
| 3816 |
return nil, err |
| 3817 |
} |
| 3818 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 3819 |
|
| 3820 |
params := url.Values{} |
| 3821 |
params.Add("$alt", "json;enum-encoding=int") |
| 3822 |
|
| 3823 |
baseUrl.RawQuery = params.Encode() |
| 3824 |
|
| 3825 |
|
| 3826 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 3827 |
|
| 3828 |
hds = append(c.xGoogHeaders, hds...) |
| 3829 |
hds = append(hds, "Content-Type", "application/json") |
| 3830 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3831 |
opts = append((*c.CallOptions).GetHydratedDeployment[0:len((*c.CallOptions).GetHydratedDeployment):len((*c.CallOptions).GetHydratedDeployment)], opts...) |
| 3832 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3833 |
resp := &telcoautomationpb.HydratedDeployment{} |
| 3834 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3835 |
if settings.Path != "" { |
| 3836 |
baseUrl.Path = settings.Path |
| 3837 |
} |
| 3838 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 3839 |
if err != nil { |
| 3840 |
return err |
| 3841 |
} |
| 3842 |
httpReq = httpReq.WithContext(ctx) |
| 3843 |
httpReq.Header = headers |
| 3844 |
|
| 3845 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetHydratedDeployment") |
| 3846 |
if err != nil { |
| 3847 |
return err |
| 3848 |
} |
| 3849 |
|
| 3850 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3851 |
return err |
| 3852 |
} |
| 3853 |
|
| 3854 |
return nil |
| 3855 |
}, opts...) |
| 3856 |
if e != nil { |
| 3857 |
return nil, e |
| 3858 |
} |
| 3859 |
return resp, nil |
| 3860 |
} |
| 3861 |
|
| 3862 |
|
| 3863 |
func (c *restClient) ListHydratedDeployments(ctx context.Context, req *telcoautomationpb.ListHydratedDeploymentsRequest, opts ...gax.CallOption) *HydratedDeploymentIterator { |
| 3864 |
it := &HydratedDeploymentIterator{} |
| 3865 |
req = proto.Clone(req).(*telcoautomationpb.ListHydratedDeploymentsRequest) |
| 3866 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3867 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*telcoautomationpb.HydratedDeployment, string, error) { |
| 3868 |
resp := &telcoautomationpb.ListHydratedDeploymentsResponse{} |
| 3869 |
if pageToken != "" { |
| 3870 |
req.PageToken = pageToken |
| 3871 |
} |
| 3872 |
if pageSize > math.MaxInt32 { |
| 3873 |
req.PageSize = math.MaxInt32 |
| 3874 |
} else if pageSize != 0 { |
| 3875 |
req.PageSize = int32(pageSize) |
| 3876 |
} |
| 3877 |
baseUrl, err := url.Parse(c.endpoint) |
| 3878 |
if err != nil { |
| 3879 |
return nil, "", err |
| 3880 |
} |
| 3881 |
baseUrl.Path += fmt.Sprintf("/v1/%v/hydratedDeployments", req.GetParent()) |
| 3882 |
|
| 3883 |
params := url.Values{} |
| 3884 |
params.Add("$alt", "json;enum-encoding=int") |
| 3885 |
if req.GetPageSize() != 0 { |
| 3886 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 3887 |
} |
| 3888 |
if req.GetPageToken() != "" { |
| 3889 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 3890 |
} |
| 3891 |
|
| 3892 |
baseUrl.RawQuery = params.Encode() |
| 3893 |
|
| 3894 |
|
| 3895 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 3896 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3897 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3898 |
if settings.Path != "" { |
| 3899 |
baseUrl.Path = settings.Path |
| 3900 |
} |
| 3901 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 3902 |
if err != nil { |
| 3903 |
return err |
| 3904 |
} |
| 3905 |
httpReq.Header = headers |
| 3906 |
|
| 3907 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListHydratedDeployments") |
| 3908 |
if err != nil { |
| 3909 |
return err |
| 3910 |
} |
| 3911 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3912 |
return err |
| 3913 |
} |
| 3914 |
|
| 3915 |
return nil |
| 3916 |
}, opts...) |
| 3917 |
if e != nil { |
| 3918 |
return nil, "", e |
| 3919 |
} |
| 3920 |
it.Response = resp |
| 3921 |
return resp.GetHydratedDeployments(), resp.GetNextPageToken(), nil |
| 3922 |
} |
| 3923 |
|
| 3924 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 3925 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 3926 |
if err != nil { |
| 3927 |
return "", err |
| 3928 |
} |
| 3929 |
it.items = append(it.items, items...) |
| 3930 |
return nextPageToken, nil |
| 3931 |
} |
| 3932 |
|
| 3933 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 3934 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 3935 |
it.pageInfo.Token = req.GetPageToken() |
| 3936 |
|
| 3937 |
return it |
| 3938 |
} |
| 3939 |
|
| 3940 |
|
| 3941 |
func (c *restClient) UpdateHydratedDeployment(ctx context.Context, req *telcoautomationpb.UpdateHydratedDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.HydratedDeployment, error) { |
| 3942 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 3943 |
body := req.GetHydratedDeployment() |
| 3944 |
jsonReq, err := m.Marshal(body) |
| 3945 |
if err != nil { |
| 3946 |
return nil, err |
| 3947 |
} |
| 3948 |
|
| 3949 |
baseUrl, err := url.Parse(c.endpoint) |
| 3950 |
if err != nil { |
| 3951 |
return nil, err |
| 3952 |
} |
| 3953 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetHydratedDeployment().GetName()) |
| 3954 |
|
| 3955 |
params := url.Values{} |
| 3956 |
params.Add("$alt", "json;enum-encoding=int") |
| 3957 |
if req.GetUpdateMask() != nil { |
| 3958 |
field, err := protojson.Marshal(req.GetUpdateMask()) |
| 3959 |
if err != nil { |
| 3960 |
return nil, err |
| 3961 |
} |
| 3962 |
params.Add("updateMask", string(field[1:len(field)-1])) |
| 3963 |
} |
| 3964 |
|
| 3965 |
baseUrl.RawQuery = params.Encode() |
| 3966 |
|
| 3967 |
|
| 3968 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "hydrated_deployment.name", url.QueryEscape(req.GetHydratedDeployment().GetName()))} |
| 3969 |
|
| 3970 |
hds = append(c.xGoogHeaders, hds...) |
| 3971 |
hds = append(hds, "Content-Type", "application/json") |
| 3972 |
headers := gax.BuildHeaders(ctx, hds...) |
| 3973 |
opts = append((*c.CallOptions).UpdateHydratedDeployment[0:len((*c.CallOptions).UpdateHydratedDeployment):len((*c.CallOptions).UpdateHydratedDeployment)], opts...) |
| 3974 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 3975 |
resp := &telcoautomationpb.HydratedDeployment{} |
| 3976 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 3977 |
if settings.Path != "" { |
| 3978 |
baseUrl.Path = settings.Path |
| 3979 |
} |
| 3980 |
httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 3981 |
if err != nil { |
| 3982 |
return err |
| 3983 |
} |
| 3984 |
httpReq = httpReq.WithContext(ctx) |
| 3985 |
httpReq.Header = headers |
| 3986 |
|
| 3987 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "UpdateHydratedDeployment") |
| 3988 |
if err != nil { |
| 3989 |
return err |
| 3990 |
} |
| 3991 |
|
| 3992 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 3993 |
return err |
| 3994 |
} |
| 3995 |
|
| 3996 |
return nil |
| 3997 |
}, opts...) |
| 3998 |
if e != nil { |
| 3999 |
return nil, e |
| 4000 |
} |
| 4001 |
return resp, nil |
| 4002 |
} |
| 4003 |
|
| 4004 |
|
| 4005 |
func (c *restClient) ApplyHydratedDeployment(ctx context.Context, req *telcoautomationpb.ApplyHydratedDeploymentRequest, opts ...gax.CallOption) (*telcoautomationpb.HydratedDeployment, error) { |
| 4006 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 4007 |
jsonReq, err := m.Marshal(req) |
| 4008 |
if err != nil { |
| 4009 |
return nil, err |
| 4010 |
} |
| 4011 |
|
| 4012 |
baseUrl, err := url.Parse(c.endpoint) |
| 4013 |
if err != nil { |
| 4014 |
return nil, err |
| 4015 |
} |
| 4016 |
baseUrl.Path += fmt.Sprintf("/v1/%v:apply", req.GetName()) |
| 4017 |
|
| 4018 |
params := url.Values{} |
| 4019 |
params.Add("$alt", "json;enum-encoding=int") |
| 4020 |
|
| 4021 |
baseUrl.RawQuery = params.Encode() |
| 4022 |
|
| 4023 |
|
| 4024 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 4025 |
|
| 4026 |
hds = append(c.xGoogHeaders, hds...) |
| 4027 |
hds = append(hds, "Content-Type", "application/json") |
| 4028 |
headers := gax.BuildHeaders(ctx, hds...) |
| 4029 |
opts = append((*c.CallOptions).ApplyHydratedDeployment[0:len((*c.CallOptions).ApplyHydratedDeployment):len((*c.CallOptions).ApplyHydratedDeployment)], opts...) |
| 4030 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 4031 |
resp := &telcoautomationpb.HydratedDeployment{} |
| 4032 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 4033 |
if settings.Path != "" { |
| 4034 |
baseUrl.Path = settings.Path |
| 4035 |
} |
| 4036 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 4037 |
if err != nil { |
| 4038 |
return err |
| 4039 |
} |
| 4040 |
httpReq = httpReq.WithContext(ctx) |
| 4041 |
httpReq.Header = headers |
| 4042 |
|
| 4043 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "ApplyHydratedDeployment") |
| 4044 |
if err != nil { |
| 4045 |
return err |
| 4046 |
} |
| 4047 |
|
| 4048 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 4049 |
return err |
| 4050 |
} |
| 4051 |
|
| 4052 |
return nil |
| 4053 |
}, opts...) |
| 4054 |
if e != nil { |
| 4055 |
return nil, e |
| 4056 |
} |
| 4057 |
return resp, nil |
| 4058 |
} |
| 4059 |
|
| 4060 |
|
| 4061 |
func (c *restClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error) { |
| 4062 |
baseUrl, err := url.Parse(c.endpoint) |
| 4063 |
if err != nil { |
| 4064 |
return nil, err |
| 4065 |
} |
| 4066 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 4067 |
|
| 4068 |
params := url.Values{} |
| 4069 |
params.Add("$alt", "json;enum-encoding=int") |
| 4070 |
|
| 4071 |
baseUrl.RawQuery = params.Encode() |
| 4072 |
|
| 4073 |
|
| 4074 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 4075 |
|
| 4076 |
hds = append(c.xGoogHeaders, hds...) |
| 4077 |
hds = append(hds, "Content-Type", "application/json") |
| 4078 |
headers := gax.BuildHeaders(ctx, hds...) |
| 4079 |
opts = append((*c.CallOptions).GetLocation[0:len((*c.CallOptions).GetLocation):len((*c.CallOptions).GetLocation)], opts...) |
| 4080 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 4081 |
resp := &locationpb.Location{} |
| 4082 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 4083 |
if settings.Path != "" { |
| 4084 |
baseUrl.Path = settings.Path |
| 4085 |
} |
| 4086 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 4087 |
if err != nil { |
| 4088 |
return err |
| 4089 |
} |
| 4090 |
httpReq = httpReq.WithContext(ctx) |
| 4091 |
httpReq.Header = headers |
| 4092 |
|
| 4093 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetLocation") |
| 4094 |
if err != nil { |
| 4095 |
return err |
| 4096 |
} |
| 4097 |
|
| 4098 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 4099 |
return err |
| 4100 |
} |
| 4101 |
|
| 4102 |
return nil |
| 4103 |
}, opts...) |
| 4104 |
if e != nil { |
| 4105 |
return nil, e |
| 4106 |
} |
| 4107 |
return resp, nil |
| 4108 |
} |
| 4109 |
|
| 4110 |
|
| 4111 |
func (c *restClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator { |
| 4112 |
it := &LocationIterator{} |
| 4113 |
req = proto.Clone(req).(*locationpb.ListLocationsRequest) |
| 4114 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 4115 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*locationpb.Location, string, error) { |
| 4116 |
resp := &locationpb.ListLocationsResponse{} |
| 4117 |
if pageToken != "" { |
| 4118 |
req.PageToken = pageToken |
| 4119 |
} |
| 4120 |
if pageSize > math.MaxInt32 { |
| 4121 |
req.PageSize = math.MaxInt32 |
| 4122 |
} else if pageSize != 0 { |
| 4123 |
req.PageSize = int32(pageSize) |
| 4124 |
} |
| 4125 |
baseUrl, err := url.Parse(c.endpoint) |
| 4126 |
if err != nil { |
| 4127 |
return nil, "", err |
| 4128 |
} |
| 4129 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 4130 |
|
| 4131 |
params := url.Values{} |
| 4132 |
params.Add("$alt", "json;enum-encoding=int") |
| 4133 |
if req.GetFilter() != "" { |
| 4134 |
params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) |
| 4135 |
} |
| 4136 |
if req.GetPageSize() != 0 { |
| 4137 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 4138 |
} |
| 4139 |
if req.GetPageToken() != "" { |
| 4140 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 4141 |
} |
| 4142 |
|
| 4143 |
baseUrl.RawQuery = params.Encode() |
| 4144 |
|
| 4145 |
|
| 4146 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 4147 |
headers := gax.BuildHeaders(ctx, hds...) |
| 4148 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 4149 |
if settings.Path != "" { |
| 4150 |
baseUrl.Path = settings.Path |
| 4151 |
} |
| 4152 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 4153 |
if err != nil { |
| 4154 |
return err |
| 4155 |
} |
| 4156 |
httpReq.Header = headers |
| 4157 |
|
| 4158 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListLocations") |
| 4159 |
if err != nil { |
| 4160 |
return err |
| 4161 |
} |
| 4162 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 4163 |
return err |
| 4164 |
} |
| 4165 |
|
| 4166 |
return nil |
| 4167 |
}, opts...) |
| 4168 |
if e != nil { |
| 4169 |
return nil, "", e |
| 4170 |
} |
| 4171 |
it.Response = resp |
| 4172 |
return resp.GetLocations(), resp.GetNextPageToken(), nil |
| 4173 |
} |
| 4174 |
|
| 4175 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 4176 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 4177 |
if err != nil { |
| 4178 |
return "", err |
| 4179 |
} |
| 4180 |
it.items = append(it.items, items...) |
| 4181 |
return nextPageToken, nil |
| 4182 |
} |
| 4183 |
|
| 4184 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 4185 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 4186 |
it.pageInfo.Token = req.GetPageToken() |
| 4187 |
|
| 4188 |
return it |
| 4189 |
} |
| 4190 |
|
| 4191 |
|
| 4192 |
func (c *restClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error { |
| 4193 |
m := protojson.MarshalOptions{AllowPartial: true, UseEnumNumbers: true} |
| 4194 |
jsonReq, err := m.Marshal(req) |
| 4195 |
if err != nil { |
| 4196 |
return err |
| 4197 |
} |
| 4198 |
|
| 4199 |
baseUrl, err := url.Parse(c.endpoint) |
| 4200 |
if err != nil { |
| 4201 |
return err |
| 4202 |
} |
| 4203 |
baseUrl.Path += fmt.Sprintf("/v1/%v:cancel", req.GetName()) |
| 4204 |
|
| 4205 |
params := url.Values{} |
| 4206 |
params.Add("$alt", "json;enum-encoding=int") |
| 4207 |
|
| 4208 |
baseUrl.RawQuery = params.Encode() |
| 4209 |
|
| 4210 |
|
| 4211 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 4212 |
|
| 4213 |
hds = append(c.xGoogHeaders, hds...) |
| 4214 |
hds = append(hds, "Content-Type", "application/json") |
| 4215 |
headers := gax.BuildHeaders(ctx, hds...) |
| 4216 |
return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 4217 |
if settings.Path != "" { |
| 4218 |
baseUrl.Path = settings.Path |
| 4219 |
} |
| 4220 |
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) |
| 4221 |
if err != nil { |
| 4222 |
return err |
| 4223 |
} |
| 4224 |
httpReq = httpReq.WithContext(ctx) |
| 4225 |
httpReq.Header = headers |
| 4226 |
|
| 4227 |
_, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, jsonReq, "CancelOperation") |
| 4228 |
return err |
| 4229 |
}, opts...) |
| 4230 |
} |
| 4231 |
|
| 4232 |
|
| 4233 |
func (c *restClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error { |
| 4234 |
baseUrl, err := url.Parse(c.endpoint) |
| 4235 |
if err != nil { |
| 4236 |
return err |
| 4237 |
} |
| 4238 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 4239 |
|
| 4240 |
params := url.Values{} |
| 4241 |
params.Add("$alt", "json;enum-encoding=int") |
| 4242 |
|
| 4243 |
baseUrl.RawQuery = params.Encode() |
| 4244 |
|
| 4245 |
|
| 4246 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 4247 |
|
| 4248 |
hds = append(c.xGoogHeaders, hds...) |
| 4249 |
hds = append(hds, "Content-Type", "application/json") |
| 4250 |
headers := gax.BuildHeaders(ctx, hds...) |
| 4251 |
return gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 4252 |
if settings.Path != "" { |
| 4253 |
baseUrl.Path = settings.Path |
| 4254 |
} |
| 4255 |
httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) |
| 4256 |
if err != nil { |
| 4257 |
return err |
| 4258 |
} |
| 4259 |
httpReq = httpReq.WithContext(ctx) |
| 4260 |
httpReq.Header = headers |
| 4261 |
|
| 4262 |
_, err = executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "DeleteOperation") |
| 4263 |
return err |
| 4264 |
}, opts...) |
| 4265 |
} |
| 4266 |
|
| 4267 |
|
| 4268 |
func (c *restClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error) { |
| 4269 |
baseUrl, err := url.Parse(c.endpoint) |
| 4270 |
if err != nil { |
| 4271 |
return nil, err |
| 4272 |
} |
| 4273 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 4274 |
|
| 4275 |
params := url.Values{} |
| 4276 |
params.Add("$alt", "json;enum-encoding=int") |
| 4277 |
|
| 4278 |
baseUrl.RawQuery = params.Encode() |
| 4279 |
|
| 4280 |
|
| 4281 |
hds := []string{"x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))} |
| 4282 |
|
| 4283 |
hds = append(c.xGoogHeaders, hds...) |
| 4284 |
hds = append(hds, "Content-Type", "application/json") |
| 4285 |
headers := gax.BuildHeaders(ctx, hds...) |
| 4286 |
opts = append((*c.CallOptions).GetOperation[0:len((*c.CallOptions).GetOperation):len((*c.CallOptions).GetOperation)], opts...) |
| 4287 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 4288 |
resp := &longrunningpb.Operation{} |
| 4289 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 4290 |
if settings.Path != "" { |
| 4291 |
baseUrl.Path = settings.Path |
| 4292 |
} |
| 4293 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 4294 |
if err != nil { |
| 4295 |
return err |
| 4296 |
} |
| 4297 |
httpReq = httpReq.WithContext(ctx) |
| 4298 |
httpReq.Header = headers |
| 4299 |
|
| 4300 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "GetOperation") |
| 4301 |
if err != nil { |
| 4302 |
return err |
| 4303 |
} |
| 4304 |
|
| 4305 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 4306 |
return err |
| 4307 |
} |
| 4308 |
|
| 4309 |
return nil |
| 4310 |
}, opts...) |
| 4311 |
if e != nil { |
| 4312 |
return nil, e |
| 4313 |
} |
| 4314 |
return resp, nil |
| 4315 |
} |
| 4316 |
|
| 4317 |
|
| 4318 |
func (c *restClient) ListOperations(ctx context.Context, req *longrunningpb.ListOperationsRequest, opts ...gax.CallOption) *OperationIterator { |
| 4319 |
it := &OperationIterator{} |
| 4320 |
req = proto.Clone(req).(*longrunningpb.ListOperationsRequest) |
| 4321 |
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true} |
| 4322 |
it.InternalFetch = func(pageSize int, pageToken string) ([]*longrunningpb.Operation, string, error) { |
| 4323 |
resp := &longrunningpb.ListOperationsResponse{} |
| 4324 |
if pageToken != "" { |
| 4325 |
req.PageToken = pageToken |
| 4326 |
} |
| 4327 |
if pageSize > math.MaxInt32 { |
| 4328 |
req.PageSize = math.MaxInt32 |
| 4329 |
} else if pageSize != 0 { |
| 4330 |
req.PageSize = int32(pageSize) |
| 4331 |
} |
| 4332 |
baseUrl, err := url.Parse(c.endpoint) |
| 4333 |
if err != nil { |
| 4334 |
return nil, "", err |
| 4335 |
} |
| 4336 |
baseUrl.Path += fmt.Sprintf("/v1/%v", req.GetName()) |
| 4337 |
|
| 4338 |
params := url.Values{} |
| 4339 |
params.Add("$alt", "json;enum-encoding=int") |
| 4340 |
if req.GetFilter() != "" { |
| 4341 |
params.Add("filter", fmt.Sprintf("%v", req.GetFilter())) |
| 4342 |
} |
| 4343 |
if req.GetPageSize() != 0 { |
| 4344 |
params.Add("pageSize", fmt.Sprintf("%v", req.GetPageSize())) |
| 4345 |
} |
| 4346 |
if req.GetPageToken() != "" { |
| 4347 |
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken())) |
| 4348 |
} |
| 4349 |
|
| 4350 |
baseUrl.RawQuery = params.Encode() |
| 4351 |
|
| 4352 |
|
| 4353 |
hds := append(c.xGoogHeaders, "Content-Type", "application/json") |
| 4354 |
headers := gax.BuildHeaders(ctx, hds...) |
| 4355 |
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { |
| 4356 |
if settings.Path != "" { |
| 4357 |
baseUrl.Path = settings.Path |
| 4358 |
} |
| 4359 |
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) |
| 4360 |
if err != nil { |
| 4361 |
return err |
| 4362 |
} |
| 4363 |
httpReq.Header = headers |
| 4364 |
|
| 4365 |
buf, err := executeHTTPRequest(ctx, c.httpClient, httpReq, c.logger, nil, "ListOperations") |
| 4366 |
if err != nil { |
| 4367 |
return err |
| 4368 |
} |
| 4369 |
if err := unm.Unmarshal(buf, resp); err != nil { |
| 4370 |
return err |
| 4371 |
} |
| 4372 |
|
| 4373 |
return nil |
| 4374 |
}, opts...) |
| 4375 |
if e != nil { |
| 4376 |
return nil, "", e |
| 4377 |
} |
| 4378 |
it.Response = resp |
| 4379 |
return resp.GetOperations(), resp.GetNextPageToken(), nil |
| 4380 |
} |
| 4381 |
|
| 4382 |
fetch := func(pageSize int, pageToken string) (string, error) { |
| 4383 |
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) |
| 4384 |
if err != nil { |
| 4385 |
return "", err |
| 4386 |
} |
| 4387 |
it.items = append(it.items, items...) |
| 4388 |
return nextPageToken, nil |
| 4389 |
} |
| 4390 |
|
| 4391 |
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) |
| 4392 |
it.pageInfo.MaxSize = int(req.GetPageSize()) |
| 4393 |
it.pageInfo.Token = req.GetPageToken() |
| 4394 |
|
| 4395 |
return it |
| 4396 |
} |
| 4397 |
|
| 4398 |
|
| 4399 |
|
| 4400 |
func (c *gRPCClient) CreateEdgeSlmOperation(name string) *CreateEdgeSlmOperation { |
| 4401 |
return &CreateEdgeSlmOperation{ |
| 4402 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 4403 |
} |
| 4404 |
} |
| 4405 |
|
| 4406 |
|
| 4407 |
|
| 4408 |
func (c *restClient) CreateEdgeSlmOperation(name string) *CreateEdgeSlmOperation { |
| 4409 |
override := fmt.Sprintf("/v1/%s", name) |
| 4410 |
return &CreateEdgeSlmOperation{ |
| 4411 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 4412 |
pollPath: override, |
| 4413 |
} |
| 4414 |
} |
| 4415 |
|
| 4416 |
|
| 4417 |
|
| 4418 |
func (c *gRPCClient) CreateOrchestrationClusterOperation(name string) *CreateOrchestrationClusterOperation { |
| 4419 |
return &CreateOrchestrationClusterOperation{ |
| 4420 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 4421 |
} |
| 4422 |
} |
| 4423 |
|
| 4424 |
|
| 4425 |
|
| 4426 |
func (c *restClient) CreateOrchestrationClusterOperation(name string) *CreateOrchestrationClusterOperation { |
| 4427 |
override := fmt.Sprintf("/v1/%s", name) |
| 4428 |
return &CreateOrchestrationClusterOperation{ |
| 4429 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 4430 |
pollPath: override, |
| 4431 |
} |
| 4432 |
} |
| 4433 |
|
| 4434 |
|
| 4435 |
|
| 4436 |
func (c *gRPCClient) DeleteEdgeSlmOperation(name string) *DeleteEdgeSlmOperation { |
| 4437 |
return &DeleteEdgeSlmOperation{ |
| 4438 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 4439 |
} |
| 4440 |
} |
| 4441 |
|
| 4442 |
|
| 4443 |
|
| 4444 |
func (c *restClient) DeleteEdgeSlmOperation(name string) *DeleteEdgeSlmOperation { |
| 4445 |
override := fmt.Sprintf("/v1/%s", name) |
| 4446 |
return &DeleteEdgeSlmOperation{ |
| 4447 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 4448 |
pollPath: override, |
| 4449 |
} |
| 4450 |
} |
| 4451 |
|
| 4452 |
|
| 4453 |
|
| 4454 |
func (c *gRPCClient) DeleteOrchestrationClusterOperation(name string) *DeleteOrchestrationClusterOperation { |
| 4455 |
return &DeleteOrchestrationClusterOperation{ |
| 4456 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 4457 |
} |
| 4458 |
} |
| 4459 |
|
| 4460 |
|
| 4461 |
|
| 4462 |
func (c *restClient) DeleteOrchestrationClusterOperation(name string) *DeleteOrchestrationClusterOperation { |
| 4463 |
override := fmt.Sprintf("/v1/%s", name) |
| 4464 |
return &DeleteOrchestrationClusterOperation{ |
| 4465 |
lro: longrunning.InternalNewOperation(*c.LROClient, &longrunningpb.Operation{Name: name}), |
| 4466 |
pollPath: override, |
| 4467 |
} |
| 4468 |
} |