build(deps): bump cloud.google.com/go/compute from 1.9.0 to 1.10.0

Bumps [cloud.google.com/go/compute](https://github.com/googleapis/google-cloud-go) from 1.9.0 to 1.10.0.
- [Release notes](https://github.com/googleapis/google-cloud-go/releases)
- [Changelog](https://github.com/googleapis/google-cloud-go/blob/main/CHANGES.md)
- [Commits](https://github.com/googleapis/google-cloud-go/compare/pubsub/v1.9.0...pubsub/v1.10.0)

---
updated-dependencies:
- dependency-name: cloud.google.com/go/compute
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot] 2022-09-19 21:02:06 +00:00 committed by Ondřej Budai
parent f211273732
commit db7327eb69
95 changed files with 50501 additions and 44286 deletions

6
go.mod
View file

@ -6,7 +6,7 @@ exclude github.com/mattn/go-sqlite3 v2.0.3+incompatible
require (
cloud.google.com/go/cloudbuild v1.2.0
cloud.google.com/go/compute v1.9.0
cloud.google.com/go/compute v1.10.0
cloud.google.com/go/storage v1.26.0
github.com/Azure/azure-pipeline-go v0.2.3
github.com/Azure/azure-sdk-for-go v66.0.0+incompatible
@ -45,10 +45,10 @@ require (
github.com/stretchr/testify v1.8.0
github.com/ubccr/kerby v0.0.0-20170626144437-201a958fc453
github.com/vmware/govmomi v0.29.0
golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1
golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f
golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10
google.golang.org/api v0.96.0
google.golang.org/genproto v0.0.0-20220810155839-1856144b1d9c
google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de
gopkg.in/ini.v1 v1.67.0
)

16
go.sum
View file

@ -36,6 +36,7 @@ cloud.google.com/go v0.100.2/go.mod h1:4Xra9TjzAeYHrl5+oeLlzbM2k3mjVhZh4UqTZ//w9
cloud.google.com/go v0.102.0/go.mod h1:oWcCzKlqJ5zgHQt9YsaeTY9KzIvjyy0ArmiBUgpQ+nc=
cloud.google.com/go v0.102.1 h1:vpK6iQWv/2uUeFJth4/cBHsQAGjn1iIE6AAlxipRaA0=
cloud.google.com/go v0.102.1/go.mod h1:XZ77E9qnTEnrgEOvr4xzfdX5TRo7fB4T2F4O6+34hIU=
cloud.google.com/go/asset v1.5.0/go.mod h1:5mfs8UvcM5wHhqtSv8J1CtxxaQq3AdBxxQi2jGW/K4o=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
@ -50,8 +51,8 @@ cloud.google.com/go/compute v1.5.0/go.mod h1:9SMHyhJlzhlkJqrPAc839t2BZFTSk6Jdj6m
cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz/FMzPu0s=
cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU=
cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U=
cloud.google.com/go/compute v1.9.0 h1:ED/FP4xv8GJw63v556/ASNc1CeeLUO2Bs8nzaHchkHg=
cloud.google.com/go/compute v1.9.0/go.mod h1:lWv1h/zUWTm/LozzfTJhBSkd6ShQq8la8VeeuOEGxfY=
cloud.google.com/go/compute v1.10.0 h1:aoLIYaA1fX3ywihqpBk2APQKOo20nXsp1GEZQbx5Jk4=
cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
@ -65,6 +66,7 @@ cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
cloud.google.com/go/pubsub v1.3.1/go.mod h1:i+ucay31+CNRpDW4Lu78I4xXG+O1r/MAHgjpRVR+TSU=
cloud.google.com/go/pubsub v1.5.0/go.mod h1:ZEwJccE3z93Z2HWvstpri00jOg7oO4UZDtKhwDwqF0w=
cloud.google.com/go/security v1.5.0/go.mod h1:lgxGdyOKKjHL4YG3/YwIL2zLqMFCKs0UbQwgyZmfJl4=
cloud.google.com/go/spanner v1.7.0/go.mod h1:sd3K2gZ9Fd0vMPLXzeCrF6fq4i63Q7aTLW/lBIfBkIk=
cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiyrjsg+URw=
cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos=
@ -1952,8 +1954,9 @@ golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j
golang.org/x/oauth2 v0.0.0-20220524215830-622c5d57e401/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc=
golang.org/x/oauth2 v0.0.0-20220608161450-d0670ef3b1eb/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE=
golang.org/x/oauth2 v0.0.0-20220622183110-fd043fe589d2/go.mod h1:jaDAt6Dkxork7LmZnYtzbRWj0W47D86a3TGe0YHBvmE=
golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094 h1:2o1E+E8TpNLklK9nHiPiK1uzIYrIHt+cQx3ynCwq9V8=
golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1 h1:lxqLZaMad/dJHMFZH0NiNpiEZI/nhgWhe4wgzpE+MuA=
golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -2309,7 +2312,7 @@ google.golang.org/api v0.78.0/go.mod h1:1Sg78yoMLOhlQTeF+ARBoytAcH1NNyyl390YMy6r
google.golang.org/api v0.80.0/go.mod h1:xY3nI94gbvBrE0J6NHXhxOmW97HG7Khjkku6AFB3Hyg=
google.golang.org/api v0.84.0/go.mod h1:NTsGnUFJMYROtiquksZHBWtHfeMC7iYthki7Eq3pa8o=
google.golang.org/api v0.86.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw=
google.golang.org/api v0.91.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw=
google.golang.org/api v0.93.0/go.mod h1:+Sem1dnrKlrXMR/X0bPnMWyluQe4RsNoYfmNLhOIkzw=
google.golang.org/api v0.94.0/go.mod h1:eADj+UBuxkh5zlrSntJghuNeg8HwQ1w5lTKkuqaETEI=
google.golang.org/api v0.96.0 h1:F60cuQPJq7K7FzsxMYHAUJSiXh2oKctHxBMbDygxhfM=
google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s=
@ -2414,9 +2417,10 @@ google.golang.org/genproto v0.0.0-20220608133413-ed9918b62aac/go.mod h1:KEWEmljW
google.golang.org/genproto v0.0.0-20220616135557-88e70c0c3a90/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
google.golang.org/genproto v0.0.0-20220617124728-180714bec0ad/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
google.golang.org/genproto v0.0.0-20220624142145-8cd45d7dbd1f/go.mod h1:KEWEmljWE5zPzLBa/oHl6DaEt9LmfH6WtH1OHIvleBA=
google.golang.org/genproto v0.0.0-20220804142021-4e6b2dfa6612/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc=
google.golang.org/genproto v0.0.0-20220810155839-1856144b1d9c h1:IooGDWedfLC6KLczH/uduUsKQP42ZZYhKx+zd50L1Sk=
google.golang.org/genproto v0.0.0-20220810155839-1856144b1d9c/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
google.golang.org/genproto v0.0.0-20220815135757-37a418bb8959/go.mod h1:dbqgFATTzChvnt+ujMdZwITVAJHFtfyN1qUhDqEiIlk=
google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de h1:5ANeKFmGdtiputJJYeUVg8nTGA/1bEirx4CgzcnPSx8=
google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de/go.mod h1:0Nb8Qy+Sk5eDzHnzlStwW3itdNaWoZA5XeSG+R3JHSo=
google.golang.org/grpc v0.0.0-20160317175043-d3ddb4469d5a/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.8.0/go.mod h1:yo6s7OP7yaDglbqo1J04qKzAhqBH6lvTonzMVmEdcZw=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=

View file

@ -96,7 +96,8 @@ func (c *AcceleratorTypesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *AcceleratorTypesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -182,7 +183,7 @@ func (c *acceleratorTypesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *acceleratorTypesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -48,6 +48,7 @@ type AddressesCallOptions struct {
Get []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
SetLabels []gax.CallOption
}
func defaultAddressesRESTCallOptions() *AddressesCallOptions {
@ -57,6 +58,7 @@ func defaultAddressesRESTCallOptions() *AddressesCallOptions {
Get: []gax.CallOption{},
Insert: []gax.CallOption{},
List: []gax.CallOption{},
SetLabels: []gax.CallOption{},
}
}
@ -70,6 +72,7 @@ type internalAddressesClient interface {
Get(context.Context, *computepb.GetAddressRequest, ...gax.CallOption) (*computepb.Address, error)
Insert(context.Context, *computepb.InsertAddressRequest, ...gax.CallOption) (*Operation, error)
List(context.Context, *computepb.ListAddressesRequest, ...gax.CallOption) *AddressIterator
SetLabels(context.Context, *computepb.SetLabelsAddressRequest, ...gax.CallOption) (*Operation, error)
}
// AddressesClient is a client for interacting with Google Compute Engine API.
@ -101,7 +104,8 @@ func (c *AddressesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *AddressesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -131,6 +135,11 @@ func (c *AddressesClient) List(ctx context.Context, req *computepb.ListAddresses
return c.internalClient.List(ctx, req, opts...)
}
// SetLabels sets the labels on an Address. To learn more about labels, read the Labeling Resources documentation.
func (c *AddressesClient) SetLabels(ctx context.Context, req *computepb.SetLabelsAddressRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.SetLabels(ctx, req, opts...)
}
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type addressesRESTClient struct {
// The http endpoint to connect to.
@ -211,7 +220,7 @@ func (c *addressesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *addressesRESTClient) Connection() *grpc.ClientConn {
return nil
}
@ -614,6 +623,81 @@ func (c *addressesRESTClient) List(ctx context.Context, req *computepb.ListAddre
return it
}
// SetLabels sets the labels on an Address. To learn more about labels, read the Labeling Resources documentation.
func (c *addressesRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsAddressRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}
body := req.GetRegionSetLabelsRequestResource()
jsonReq, err := m.Marshal(body)
if err != nil {
return nil, err
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/addresses/%v/setLabels", req.GetProject(), req.GetRegion(), req.GetResource())
params := url.Values{}
if req != nil && req.RequestId != nil {
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion()), "resource", url.QueryEscape(req.GetResource())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).SetLabels[0:len((*c.CallOptions).SetLabels):len((*c.CallOptions).SetLabels)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Operation{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
op := &Operation{
&regionOperationsHandle{
c: c.operationClient,
proto: resp,
project: req.GetProject(),
region: req.GetRegion(),
},
}
return op, nil
}
// AddressIterator manages a stream of *computepb.Address.
type AddressIterator struct {
items []*computepb.Address

View file

@ -107,7 +107,8 @@ func (c *AutoscalersClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *AutoscalersClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -227,7 +228,7 @@ func (c *autoscalersRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *autoscalersRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -112,7 +112,8 @@ func (c *BackendBucketsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *BackendBucketsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -242,7 +243,7 @@ func (c *backendBucketsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *backendBucketsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -49,10 +49,12 @@ type BackendServicesCallOptions struct {
DeleteSignedUrlKey []gax.CallOption
Get []gax.CallOption
GetHealth []gax.CallOption
GetIamPolicy []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
Patch []gax.CallOption
SetEdgeSecurityPolicy []gax.CallOption
SetIamPolicy []gax.CallOption
SetSecurityPolicy []gax.CallOption
Update []gax.CallOption
}
@ -65,10 +67,12 @@ func defaultBackendServicesRESTCallOptions() *BackendServicesCallOptions {
DeleteSignedUrlKey: []gax.CallOption{},
Get: []gax.CallOption{},
GetHealth: []gax.CallOption{},
GetIamPolicy: []gax.CallOption{},
Insert: []gax.CallOption{},
List: []gax.CallOption{},
Patch: []gax.CallOption{},
SetEdgeSecurityPolicy: []gax.CallOption{},
SetIamPolicy: []gax.CallOption{},
SetSecurityPolicy: []gax.CallOption{},
Update: []gax.CallOption{},
}
@ -85,10 +89,12 @@ type internalBackendServicesClient interface {
DeleteSignedUrlKey(context.Context, *computepb.DeleteSignedUrlKeyBackendServiceRequest, ...gax.CallOption) (*Operation, error)
Get(context.Context, *computepb.GetBackendServiceRequest, ...gax.CallOption) (*computepb.BackendService, error)
GetHealth(context.Context, *computepb.GetHealthBackendServiceRequest, ...gax.CallOption) (*computepb.BackendServiceGroupHealth, error)
GetIamPolicy(context.Context, *computepb.GetIamPolicyBackendServiceRequest, ...gax.CallOption) (*computepb.Policy, error)
Insert(context.Context, *computepb.InsertBackendServiceRequest, ...gax.CallOption) (*Operation, error)
List(context.Context, *computepb.ListBackendServicesRequest, ...gax.CallOption) *BackendServiceIterator
Patch(context.Context, *computepb.PatchBackendServiceRequest, ...gax.CallOption) (*Operation, error)
SetEdgeSecurityPolicy(context.Context, *computepb.SetEdgeSecurityPolicyBackendServiceRequest, ...gax.CallOption) (*Operation, error)
SetIamPolicy(context.Context, *computepb.SetIamPolicyBackendServiceRequest, ...gax.CallOption) (*computepb.Policy, error)
SetSecurityPolicy(context.Context, *computepb.SetSecurityPolicyBackendServiceRequest, ...gax.CallOption) (*Operation, error)
Update(context.Context, *computepb.UpdateBackendServiceRequest, ...gax.CallOption) (*Operation, error)
}
@ -122,7 +128,8 @@ func (c *BackendServicesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *BackendServicesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -157,6 +164,11 @@ func (c *BackendServicesClient) GetHealth(ctx context.Context, req *computepb.Ge
return c.internalClient.GetHealth(ctx, req, opts...)
}
// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
func (c *BackendServicesClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyBackendServiceRequest, opts ...gax.CallOption) (*computepb.Policy, error) {
return c.internalClient.GetIamPolicy(ctx, req, opts...)
}
// Insert creates a BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview .
func (c *BackendServicesClient) Insert(ctx context.Context, req *computepb.InsertBackendServiceRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.Insert(ctx, req, opts...)
@ -177,6 +189,11 @@ func (c *BackendServicesClient) SetEdgeSecurityPolicy(ctx context.Context, req *
return c.internalClient.SetEdgeSecurityPolicy(ctx, req, opts...)
}
// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
func (c *BackendServicesClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyBackendServiceRequest, opts ...gax.CallOption) (*computepb.Policy, error) {
return c.internalClient.SetIamPolicy(ctx, req, opts...)
}
// SetSecurityPolicy sets the Google Cloud Armor security policy for the specified backend service. For more information, see Google Cloud Armor Overview
func (c *BackendServicesClient) SetSecurityPolicy(ctx context.Context, req *computepb.SetSecurityPolicyBackendServiceRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.SetSecurityPolicy(ctx, req, opts...)
@ -267,7 +284,7 @@ func (c *backendServicesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *backendServicesRESTClient) Connection() *grpc.ClientConn {
return nil
}
@ -700,6 +717,66 @@ func (c *backendServicesRESTClient) GetHealth(ctx context.Context, req *computep
return resp, nil
}
// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
func (c *backendServicesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyBackendServiceRequest, opts ...gax.CallOption) (*computepb.Policy, error) {
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices/%v/getIamPolicy", req.GetProject(), req.GetResource())
params := url.Values{}
if req != nil && req.OptionsRequestedPolicyVersion != nil {
params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "resource", url.QueryEscape(req.GetResource())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Policy{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
return resp, nil
}
// Insert creates a BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview .
func (c *backendServicesRESTClient) Insert(ctx context.Context, req *computepb.InsertBackendServiceRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}
@ -1018,6 +1095,66 @@ func (c *backendServicesRESTClient) SetEdgeSecurityPolicy(ctx context.Context, r
return op, nil
}
// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
func (c *backendServicesRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyBackendServiceRequest, opts ...gax.CallOption) (*computepb.Policy, error) {
m := protojson.MarshalOptions{AllowPartial: true}
body := req.GetGlobalSetPolicyRequestResource()
jsonReq, err := m.Marshal(body)
if err != nil {
return nil, err
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices/%v/setIamPolicy", req.GetProject(), req.GetResource())
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "resource", url.QueryEscape(req.GetResource())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Policy{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
return resp, nil
}
// SetSecurityPolicy sets the Google Cloud Armor security policy for the specified backend service. For more information, see Google Cloud Armor Overview
func (c *backendServicesRESTClient) SetSecurityPolicy(ctx context.Context, req *computepb.SetSecurityPolicyBackendServiceRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}

View file

@ -94,7 +94,8 @@ func (c *DiskTypesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *DiskTypesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -178,7 +179,7 @@ func (c *diskTypesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *diskTypesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -125,7 +125,8 @@ func (c *DisksClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *DisksClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -275,7 +276,7 @@ func (c *disksRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *disksRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -22,6 +22,11 @@
// To get started with this package, create a client.
//
// ctx := context.Background()
// // This snippet has been automatically generated and should be regarded as a code template only.
// // It will require modifications to work:
// // - It may require correct/in-range values for request initialization.
// // - It may require specifying regional endpoints when creating the service client as shown in:
// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
// c, err := compute.NewAcceleratorTypesClient(ctx)
// if err != nil {
// // TODO: Handle error.
@ -37,6 +42,11 @@
// The following is an example of making an API call with the newly created client.
//
// ctx := context.Background()
// // This snippet has been automatically generated and should be regarded as a code template only.
// // It will require modifications to work:
// // - It may require correct/in-range values for request initialization.
// // - It may require specifying regional endpoints when creating the service client as shown in:
// // https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
// c, err := compute.NewAcceleratorTypesRESTClient(ctx)
// if err != nil {
// // TODO: Handle error.
@ -62,7 +72,7 @@
//
// # Use of Context
//
// The ctx passed to NewClient is used for authentication requests and
// The ctx passed to NewAcceleratorTypesClient is used for authentication requests and
// for creating the underlying connection, but is not used for subsequent calls.
// Individual methods on the client use the ctx given to them.
//

View file

@ -103,7 +103,8 @@ func (c *ExternalVpnGatewaysClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *ExternalVpnGatewaysClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -218,7 +219,7 @@ func (c *externalVpnGatewaysRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *externalVpnGatewaysRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -139,7 +139,8 @@ func (c *FirewallPoliciesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *FirewallPoliciesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -314,7 +315,7 @@ func (c *firewallPoliciesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *firewallPoliciesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -103,7 +103,8 @@ func (c *FirewallsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *FirewallsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -218,7 +219,7 @@ func (c *firewallsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *firewallsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -110,7 +110,8 @@ func (c *ForwardingRulesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *ForwardingRulesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -235,7 +236,7 @@ func (c *forwardingRulesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *forwardingRulesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -58,6 +58,11 @@
"methods": [
"List"
]
},
"SetLabels": {
"methods": [
"SetLabels"
]
}
}
}
@ -196,6 +201,11 @@
"GetHealth"
]
},
"GetIamPolicy": {
"methods": [
"GetIamPolicy"
]
},
"Insert": {
"methods": [
"Insert"
@ -216,6 +226,11 @@
"SetEdgeSecurityPolicy"
]
},
"SetIamPolicy": {
"methods": [
"SetIamPolicy"
]
},
"SetSecurityPolicy": {
"methods": [
"SetSecurityPolicy"
@ -578,6 +593,11 @@
"methods": [
"List"
]
},
"SetLabels": {
"methods": [
"SetLabels"
]
}
}
}
@ -1360,6 +1380,11 @@
"methods": [
"Patch"
]
},
"SetLabels": {
"methods": [
"SetLabels"
]
}
}
}
@ -1418,6 +1443,11 @@
"methods": [
"Patch"
]
},
"SetLabels": {
"methods": [
"SetLabels"
]
}
}
}
@ -2192,6 +2222,11 @@
"GetHealth"
]
},
"GetIamPolicy": {
"methods": [
"GetIamPolicy"
]
},
"Insert": {
"methods": [
"Insert"
@ -2207,6 +2242,11 @@
"Patch"
]
},
"SetIamPolicy": {
"methods": [
"SetIamPolicy"
]
},
"Update": {
"methods": [
"Update"
@ -2802,6 +2842,45 @@
}
}
},
"RegionSslPolicies": {
"clients": {
"rest": {
"libraryClient": "RegionSslPoliciesClient",
"rpcs": {
"Delete": {
"methods": [
"Delete"
]
},
"Get": {
"methods": [
"Get"
]
},
"Insert": {
"methods": [
"Insert"
]
},
"List": {
"methods": [
"List"
]
},
"ListAvailableFeatures": {
"methods": [
"ListAvailableFeatures"
]
},
"Patch": {
"methods": [
"Patch"
]
}
}
}
}
},
"RegionTargetHttpProxies": {
"clients": {
"rest": {
@ -2880,6 +2959,35 @@
}
}
},
"RegionTargetTcpProxies": {
"clients": {
"rest": {
"libraryClient": "RegionTargetTcpProxiesClient",
"rpcs": {
"Delete": {
"methods": [
"Delete"
]
},
"Get": {
"methods": [
"Get"
]
},
"Insert": {
"methods": [
"Insert"
]
},
"List": {
"methods": [
"List"
]
}
}
}
}
},
"RegionUrlMaps": {
"clients": {
"rest": {
@ -3198,6 +3306,11 @@
"methods": [
"RemoveRule"
]
},
"SetLabels": {
"methods": [
"SetLabels"
]
}
}
}
@ -3345,6 +3458,11 @@
"rest": {
"libraryClient": "SslPoliciesClient",
"rpcs": {
"AggregatedList": {
"methods": [
"AggregatedList"
]
},
"Delete": {
"methods": [
"Delete"
@ -3810,6 +3928,11 @@
"methods": [
"List"
]
},
"SetLabels": {
"methods": [
"SetLabels"
]
}
}
}
@ -3947,6 +4070,11 @@
"methods": [
"List"
]
},
"SetLabels": {
"methods": [
"SetLabels"
]
}
}
}

View file

@ -42,18 +42,20 @@ var newGlobalAddressesClientHook clientHook
// GlobalAddressesCallOptions contains the retry settings for each method of GlobalAddressesClient.
type GlobalAddressesCallOptions struct {
Delete []gax.CallOption
Get []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
Delete []gax.CallOption
Get []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
SetLabels []gax.CallOption
}
func defaultGlobalAddressesRESTCallOptions() *GlobalAddressesCallOptions {
return &GlobalAddressesCallOptions{
Delete: []gax.CallOption{},
Get: []gax.CallOption{},
Insert: []gax.CallOption{},
List: []gax.CallOption{},
Delete: []gax.CallOption{},
Get: []gax.CallOption{},
Insert: []gax.CallOption{},
List: []gax.CallOption{},
SetLabels: []gax.CallOption{},
}
}
@ -66,6 +68,7 @@ type internalGlobalAddressesClient interface {
Get(context.Context, *computepb.GetGlobalAddressRequest, ...gax.CallOption) (*computepb.Address, error)
Insert(context.Context, *computepb.InsertGlobalAddressRequest, ...gax.CallOption) (*Operation, error)
List(context.Context, *computepb.ListGlobalAddressesRequest, ...gax.CallOption) *AddressIterator
SetLabels(context.Context, *computepb.SetLabelsGlobalAddressRequest, ...gax.CallOption) (*Operation, error)
}
// GlobalAddressesClient is a client for interacting with Google Compute Engine API.
@ -97,7 +100,8 @@ func (c *GlobalAddressesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *GlobalAddressesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -122,6 +126,11 @@ func (c *GlobalAddressesClient) List(ctx context.Context, req *computepb.ListGlo
return c.internalClient.List(ctx, req, opts...)
}
// SetLabels sets the labels on a GlobalAddress. To learn more about labels, read the Labeling Resources documentation.
func (c *GlobalAddressesClient) SetLabels(ctx context.Context, req *computepb.SetLabelsGlobalAddressRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.SetLabels(ctx, req, opts...)
}
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type globalAddressesRESTClient struct {
// The http endpoint to connect to.
@ -202,7 +211,7 @@ func (c *globalAddressesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *globalAddressesRESTClient) Connection() *grpc.ClientConn {
return nil
}
@ -496,3 +505,70 @@ func (c *globalAddressesRESTClient) List(ctx context.Context, req *computepb.Lis
return it
}
// SetLabels sets the labels on a GlobalAddress. To learn more about labels, read the Labeling Resources documentation.
func (c *globalAddressesRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsGlobalAddressRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}
body := req.GetGlobalSetLabelsRequestResource()
jsonReq, err := m.Marshal(body)
if err != nil {
return nil, err
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/addresses/%v/setLabels", req.GetProject(), req.GetResource())
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "resource", url.QueryEscape(req.GetResource())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).SetLabels[0:len((*c.CallOptions).SetLabels):len((*c.CallOptions).SetLabels)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Operation{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
op := &Operation{
&globalOperationsHandle{
c: c.operationClient,
proto: resp,
project: req.GetProject(),
},
}
return op, nil
}

View file

@ -106,7 +106,8 @@ func (c *GlobalForwardingRulesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *GlobalForwardingRulesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -226,7 +227,7 @@ func (c *globalForwardingRulesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *globalForwardingRulesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -106,7 +106,8 @@ func (c *GlobalNetworkEndpointGroupsClient) setGoogleClientInfo(keyval ...string
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *GlobalNetworkEndpointGroupsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -226,7 +227,7 @@ func (c *globalNetworkEndpointGroupsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *globalNetworkEndpointGroupsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -100,7 +100,8 @@ func (c *GlobalOperationsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *GlobalOperationsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -194,7 +195,7 @@ func (c *globalOperationsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *globalOperationsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -93,7 +93,8 @@ func (c *GlobalOrganizationOperationsClient) setGoogleClientInfo(keyval ...strin
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *GlobalOrganizationOperationsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -177,7 +178,7 @@ func (c *globalOrganizationOperationsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *globalOrganizationOperationsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -100,7 +100,8 @@ func (c *GlobalPublicDelegatedPrefixesClient) setGoogleClientInfo(keyval ...stri
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *GlobalPublicDelegatedPrefixesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -210,7 +211,7 @@ func (c *globalPublicDelegatedPrefixesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *globalPublicDelegatedPrefixesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -107,7 +107,8 @@ func (c *HealthChecksClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *HealthChecksClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -227,7 +228,7 @@ func (c *healthChecksRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *healthChecksRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -84,7 +84,8 @@ func (c *ImageFamilyViewsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *ImageFamilyViewsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -158,7 +159,7 @@ func (c *imageFamilyViewsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *imageFamilyViewsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -118,7 +118,8 @@ func (c *ImagesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *ImagesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -258,7 +259,7 @@ func (c *imagesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *imagesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -146,7 +146,8 @@ func (c *InstanceGroupManagersClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *InstanceGroupManagersClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -331,7 +332,7 @@ func (c *instanceGroupManagersRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *instanceGroupManagersRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -113,7 +113,8 @@ func (c *InstanceGroupsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *InstanceGroupsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -243,7 +244,7 @@ func (c *instanceGroupsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *instanceGroupsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -106,7 +106,8 @@ func (c *InstanceTemplatesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *InstanceTemplatesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -226,7 +227,7 @@ func (c *instanceTemplatesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *instanceTemplatesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -221,7 +221,8 @@ func (c *InstancesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *InstancesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -531,7 +532,7 @@ func (c *instancesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *instancesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -49,6 +49,7 @@ type InterconnectAttachmentsCallOptions struct {
Insert []gax.CallOption
List []gax.CallOption
Patch []gax.CallOption
SetLabels []gax.CallOption
}
func defaultInterconnectAttachmentsRESTCallOptions() *InterconnectAttachmentsCallOptions {
@ -59,6 +60,7 @@ func defaultInterconnectAttachmentsRESTCallOptions() *InterconnectAttachmentsCal
Insert: []gax.CallOption{},
List: []gax.CallOption{},
Patch: []gax.CallOption{},
SetLabels: []gax.CallOption{},
}
}
@ -73,6 +75,7 @@ type internalInterconnectAttachmentsClient interface {
Insert(context.Context, *computepb.InsertInterconnectAttachmentRequest, ...gax.CallOption) (*Operation, error)
List(context.Context, *computepb.ListInterconnectAttachmentsRequest, ...gax.CallOption) *InterconnectAttachmentIterator
Patch(context.Context, *computepb.PatchInterconnectAttachmentRequest, ...gax.CallOption) (*Operation, error)
SetLabels(context.Context, *computepb.SetLabelsInterconnectAttachmentRequest, ...gax.CallOption) (*Operation, error)
}
// InterconnectAttachmentsClient is a client for interacting with Google Compute Engine API.
@ -104,7 +107,8 @@ func (c *InterconnectAttachmentsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *InterconnectAttachmentsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -139,6 +143,11 @@ func (c *InterconnectAttachmentsClient) Patch(ctx context.Context, req *computep
return c.internalClient.Patch(ctx, req, opts...)
}
// SetLabels sets the labels on an InterconnectAttachment. To learn more about labels, read the Labeling Resources documentation.
func (c *InterconnectAttachmentsClient) SetLabels(ctx context.Context, req *computepb.SetLabelsInterconnectAttachmentRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.SetLabels(ctx, req, opts...)
}
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type interconnectAttachmentsRESTClient struct {
// The http endpoint to connect to.
@ -219,7 +228,7 @@ func (c *interconnectAttachmentsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *interconnectAttachmentsRESTClient) Connection() *grpc.ClientConn {
return nil
}
@ -700,6 +709,81 @@ func (c *interconnectAttachmentsRESTClient) Patch(ctx context.Context, req *comp
return op, nil
}
// SetLabels sets the labels on an InterconnectAttachment. To learn more about labels, read the Labeling Resources documentation.
func (c *interconnectAttachmentsRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsInterconnectAttachmentRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}
body := req.GetRegionSetLabelsRequestResource()
jsonReq, err := m.Marshal(body)
if err != nil {
return nil, err
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/interconnectAttachments/%v/setLabels", req.GetProject(), req.GetRegion(), req.GetResource())
params := url.Values{}
if req != nil && req.RequestId != nil {
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion()), "resource", url.QueryEscape(req.GetResource())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).SetLabels[0:len((*c.CallOptions).SetLabels):len((*c.CallOptions).SetLabels)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Operation{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
op := &Operation{
&regionOperationsHandle{
c: c.operationClient,
proto: resp,
project: req.GetProject(),
region: req.GetRegion(),
},
}
return op, nil
}
// InterconnectAttachmentIterator manages a stream of *computepb.InterconnectAttachment.
type InterconnectAttachmentIterator struct {
items []*computepb.InterconnectAttachment

View file

@ -90,7 +90,8 @@ func (c *InterconnectLocationsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *InterconnectLocationsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -169,7 +170,7 @@ func (c *interconnectLocationsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *interconnectLocationsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -48,6 +48,7 @@ type InterconnectsCallOptions struct {
Insert []gax.CallOption
List []gax.CallOption
Patch []gax.CallOption
SetLabels []gax.CallOption
}
func defaultInterconnectsRESTCallOptions() *InterconnectsCallOptions {
@ -58,6 +59,7 @@ func defaultInterconnectsRESTCallOptions() *InterconnectsCallOptions {
Insert: []gax.CallOption{},
List: []gax.CallOption{},
Patch: []gax.CallOption{},
SetLabels: []gax.CallOption{},
}
}
@ -72,6 +74,7 @@ type internalInterconnectsClient interface {
Insert(context.Context, *computepb.InsertInterconnectRequest, ...gax.CallOption) (*Operation, error)
List(context.Context, *computepb.ListInterconnectsRequest, ...gax.CallOption) *InterconnectIterator
Patch(context.Context, *computepb.PatchInterconnectRequest, ...gax.CallOption) (*Operation, error)
SetLabels(context.Context, *computepb.SetLabelsInterconnectRequest, ...gax.CallOption) (*Operation, error)
}
// InterconnectsClient is a client for interacting with Google Compute Engine API.
@ -103,7 +106,8 @@ func (c *InterconnectsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *InterconnectsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -138,6 +142,11 @@ func (c *InterconnectsClient) Patch(ctx context.Context, req *computepb.PatchInt
return c.internalClient.Patch(ctx, req, opts...)
}
// SetLabels sets the labels on an Interconnect. To learn more about labels, read the Labeling Resources documentation.
func (c *InterconnectsClient) SetLabels(ctx context.Context, req *computepb.SetLabelsInterconnectRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.SetLabels(ctx, req, opts...)
}
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type interconnectsRESTClient struct {
// The http endpoint to connect to.
@ -218,7 +227,7 @@ func (c *interconnectsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *interconnectsRESTClient) Connection() *grpc.ClientConn {
return nil
}
@ -640,6 +649,73 @@ func (c *interconnectsRESTClient) Patch(ctx context.Context, req *computepb.Patc
return op, nil
}
// SetLabels sets the labels on an Interconnect. To learn more about labels, read the Labeling Resources documentation.
func (c *interconnectsRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsInterconnectRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}
body := req.GetGlobalSetLabelsRequestResource()
jsonReq, err := m.Marshal(body)
if err != nil {
return nil, err
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnects/%v/setLabels", req.GetProject(), req.GetResource())
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "resource", url.QueryEscape(req.GetResource())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).SetLabels[0:len((*c.CallOptions).SetLabels):len((*c.CallOptions).SetLabels)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Operation{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
op := &Operation{
&globalOperationsHandle{
c: c.operationClient,
proto: resp,
project: req.GetProject(),
},
}
return op, nil
}
// InterconnectIterator manages a stream of *computepb.Interconnect.
type InterconnectIterator struct {
items []*computepb.Interconnect

View file

@ -88,7 +88,8 @@ func (c *LicenseCodesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *LicenseCodesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -167,7 +168,7 @@ func (c *licenseCodesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *licenseCodesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -106,7 +106,8 @@ func (c *LicensesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *LicensesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -226,7 +227,7 @@ func (c *licensesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *licensesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -106,7 +106,8 @@ func (c *MachineImagesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *MachineImagesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -226,7 +227,7 @@ func (c *machineImagesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *machineImagesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -94,7 +94,8 @@ func (c *MachineTypesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *MachineTypesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -178,7 +179,7 @@ func (c *machineTypesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *machineTypesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -101,7 +101,8 @@ func (c *NetworkEdgeSecurityServicesClient) setGoogleClientInfo(keyval ...string
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *NetworkEdgeSecurityServicesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -211,7 +212,7 @@ func (c *networkEdgeSecurityServicesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *networkEdgeSecurityServicesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -113,7 +113,8 @@ func (c *NetworkEndpointGroupsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *NetworkEndpointGroupsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -243,7 +244,7 @@ func (c *networkEndpointGroupsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *networkEndpointGroupsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -133,7 +133,8 @@ func (c *NetworkFirewallPoliciesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *NetworkFirewallPoliciesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -298,7 +299,7 @@ func (c *networkFirewallPoliciesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *networkFirewallPoliciesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -118,7 +118,8 @@ func (c *NetworksClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *NetworksClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -258,7 +259,7 @@ func (c *networksRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *networksRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -125,7 +125,8 @@ func (c *NodeGroupsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *NodeGroupsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -275,7 +276,7 @@ func (c *nodeGroupsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *nodeGroupsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -110,7 +110,8 @@ func (c *NodeTemplatesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *NodeTemplatesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -235,7 +236,7 @@ func (c *nodeTemplatesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *nodeTemplatesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -94,7 +94,8 @@ func (c *NodeTypesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *NodeTypesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -178,7 +179,7 @@ func (c *nodeTypesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *nodeTypesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -107,7 +107,8 @@ func (c *PacketMirroringsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *PacketMirroringsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -227,7 +228,7 @@ func (c *packetMirroringsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *packetMirroringsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -124,7 +124,8 @@ func (c *ProjectsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *ProjectsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -274,7 +275,7 @@ func (c *projectsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *projectsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -100,7 +100,8 @@ func (c *PublicAdvertisedPrefixesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *PublicAdvertisedPrefixesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -210,7 +211,7 @@ func (c *publicAdvertisedPrefixesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *publicAdvertisedPrefixesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -104,7 +104,8 @@ func (c *PublicDelegatedPrefixesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *PublicDelegatedPrefixesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -219,7 +220,7 @@ func (c *publicDelegatedPrefixesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *publicDelegatedPrefixesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -103,7 +103,8 @@ func (c *RegionAutoscalersClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionAutoscalersClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -218,7 +219,7 @@ func (c *regionAutoscalersRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionAutoscalersRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -42,24 +42,28 @@ var newRegionBackendServicesClientHook clientHook
// RegionBackendServicesCallOptions contains the retry settings for each method of RegionBackendServicesClient.
type RegionBackendServicesCallOptions struct {
Delete []gax.CallOption
Get []gax.CallOption
GetHealth []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
Patch []gax.CallOption
Update []gax.CallOption
Delete []gax.CallOption
Get []gax.CallOption
GetHealth []gax.CallOption
GetIamPolicy []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
Patch []gax.CallOption
SetIamPolicy []gax.CallOption
Update []gax.CallOption
}
func defaultRegionBackendServicesRESTCallOptions() *RegionBackendServicesCallOptions {
return &RegionBackendServicesCallOptions{
Delete: []gax.CallOption{},
Get: []gax.CallOption{},
GetHealth: []gax.CallOption{},
Insert: []gax.CallOption{},
List: []gax.CallOption{},
Patch: []gax.CallOption{},
Update: []gax.CallOption{},
Delete: []gax.CallOption{},
Get: []gax.CallOption{},
GetHealth: []gax.CallOption{},
GetIamPolicy: []gax.CallOption{},
Insert: []gax.CallOption{},
List: []gax.CallOption{},
Patch: []gax.CallOption{},
SetIamPolicy: []gax.CallOption{},
Update: []gax.CallOption{},
}
}
@ -71,9 +75,11 @@ type internalRegionBackendServicesClient interface {
Delete(context.Context, *computepb.DeleteRegionBackendServiceRequest, ...gax.CallOption) (*Operation, error)
Get(context.Context, *computepb.GetRegionBackendServiceRequest, ...gax.CallOption) (*computepb.BackendService, error)
GetHealth(context.Context, *computepb.GetHealthRegionBackendServiceRequest, ...gax.CallOption) (*computepb.BackendServiceGroupHealth, error)
GetIamPolicy(context.Context, *computepb.GetIamPolicyRegionBackendServiceRequest, ...gax.CallOption) (*computepb.Policy, error)
Insert(context.Context, *computepb.InsertRegionBackendServiceRequest, ...gax.CallOption) (*Operation, error)
List(context.Context, *computepb.ListRegionBackendServicesRequest, ...gax.CallOption) *BackendServiceIterator
Patch(context.Context, *computepb.PatchRegionBackendServiceRequest, ...gax.CallOption) (*Operation, error)
SetIamPolicy(context.Context, *computepb.SetIamPolicyRegionBackendServiceRequest, ...gax.CallOption) (*computepb.Policy, error)
Update(context.Context, *computepb.UpdateRegionBackendServiceRequest, ...gax.CallOption) (*Operation, error)
}
@ -106,7 +112,8 @@ func (c *RegionBackendServicesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionBackendServicesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -126,6 +133,11 @@ func (c *RegionBackendServicesClient) GetHealth(ctx context.Context, req *comput
return c.internalClient.GetHealth(ctx, req, opts...)
}
// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
func (c *RegionBackendServicesClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Policy, error) {
return c.internalClient.GetIamPolicy(ctx, req, opts...)
}
// Insert creates a regional BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview.
func (c *RegionBackendServicesClient) Insert(ctx context.Context, req *computepb.InsertRegionBackendServiceRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.Insert(ctx, req, opts...)
@ -141,6 +153,11 @@ func (c *RegionBackendServicesClient) Patch(ctx context.Context, req *computepb.
return c.internalClient.Patch(ctx, req, opts...)
}
// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
func (c *RegionBackendServicesClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Policy, error) {
return c.internalClient.SetIamPolicy(ctx, req, opts...)
}
// Update updates the specified regional BackendService resource with the data included in the request. For more information, see Backend services overview .
func (c *RegionBackendServicesClient) Update(ctx context.Context, req *computepb.UpdateRegionBackendServiceRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.Update(ctx, req, opts...)
@ -226,7 +243,7 @@ func (c *regionBackendServicesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionBackendServicesRESTClient) Connection() *grpc.ClientConn {
return nil
}
@ -412,6 +429,66 @@ func (c *regionBackendServicesRESTClient) GetHealth(ctx context.Context, req *co
return resp, nil
}
// GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists.
func (c *regionBackendServicesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Policy, error) {
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/backendServices/%v/getIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource())
params := url.Values{}
if req != nil && req.OptionsRequestedPolicyVersion != nil {
params.Add("optionsRequestedPolicyVersion", fmt.Sprintf("%v", req.GetOptionsRequestedPolicyVersion()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion()), "resource", url.QueryEscape(req.GetResource())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).GetIamPolicy[0:len((*c.CallOptions).GetIamPolicy):len((*c.CallOptions).GetIamPolicy)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Policy{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
return resp, nil
}
// Insert creates a regional BackendService resource in the specified project using the data included in the request. For more information, see Backend services overview.
func (c *regionBackendServicesRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionBackendServiceRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}
@ -658,6 +735,66 @@ func (c *regionBackendServicesRESTClient) Patch(ctx context.Context, req *comput
return op, nil
}
// SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
func (c *regionBackendServicesRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIamPolicyRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Policy, error) {
m := protojson.MarshalOptions{AllowPartial: true}
body := req.GetRegionSetPolicyRequestResource()
jsonReq, err := m.Marshal(body)
if err != nil {
return nil, err
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/backendServices/%v/setIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource())
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion()), "resource", url.QueryEscape(req.GetResource())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).SetIamPolicy[0:len((*c.CallOptions).SetIamPolicy):len((*c.CallOptions).SetIamPolicy)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Policy{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
return resp, nil
}
// Update updates the specified regional BackendService resource with the data included in the request. For more information, see Backend services overview .
func (c *regionBackendServicesRESTClient) Update(ctx context.Context, req *computepb.UpdateRegionBackendServiceRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}

View file

@ -101,7 +101,8 @@ func (c *RegionCommitmentsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionCommitmentsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -211,7 +212,7 @@ func (c *regionCommitmentsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionCommitmentsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -90,7 +90,8 @@ func (c *RegionDiskTypesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionDiskTypesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -169,7 +170,7 @@ func (c *regionDiskTypesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionDiskTypesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -121,7 +121,8 @@ func (c *RegionDisksClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionDisksClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -266,7 +267,7 @@ func (c *regionDisksRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionDisksRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -100,7 +100,8 @@ func (c *RegionHealthCheckServicesClient) setGoogleClientInfo(keyval ...string)
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionHealthCheckServicesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -210,7 +211,7 @@ func (c *regionHealthCheckServicesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionHealthCheckServicesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -103,7 +103,8 @@ func (c *RegionHealthChecksClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionHealthChecksClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -218,7 +219,7 @@ func (c *regionHealthChecksRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionHealthChecksRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -142,7 +142,8 @@ func (c *RegionInstanceGroupManagersClient) setGoogleClientInfo(keyval ...string
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionInstanceGroupManagersClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -322,7 +323,7 @@ func (c *regionInstanceGroupManagersRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionInstanceGroupManagersRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -97,7 +97,8 @@ func (c *RegionInstanceGroupsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionInstanceGroupsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -202,7 +203,7 @@ func (c *regionInstanceGroupsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionInstanceGroupsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -85,7 +85,8 @@ func (c *RegionInstancesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionInstancesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -175,7 +176,7 @@ func (c *regionInstancesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionInstancesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -97,7 +97,8 @@ func (c *RegionNetworkEndpointGroupsClient) setGoogleClientInfo(keyval ...string
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionNetworkEndpointGroupsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -202,7 +203,7 @@ func (c *regionNetworkEndpointGroupsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionNetworkEndpointGroupsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -136,7 +136,8 @@ func (c *RegionNetworkFirewallPoliciesClient) setGoogleClientInfo(keyval ...stri
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionNetworkFirewallPoliciesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -306,7 +307,7 @@ func (c *regionNetworkFirewallPoliciesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionNetworkFirewallPoliciesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -97,7 +97,8 @@ func (c *RegionNotificationEndpointsClient) setGoogleClientInfo(keyval ...string
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionNotificationEndpointsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -202,7 +203,7 @@ func (c *regionNotificationEndpointsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionNotificationEndpointsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -96,7 +96,8 @@ func (c *RegionOperationsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionOperationsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -185,7 +186,7 @@ func (c *regionOperationsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionOperationsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -100,7 +100,8 @@ func (c *RegionSecurityPoliciesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionSecurityPoliciesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -210,7 +211,7 @@ func (c *regionSecurityPoliciesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionSecurityPoliciesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -97,7 +97,8 @@ func (c *RegionSslCertificatesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionSslCertificatesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -202,7 +203,7 @@ func (c *regionSslCertificatesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionSslCertificatesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -0,0 +1,711 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go_gapic. DO NOT EDIT.
package compute
import (
"bytes"
"context"
"fmt"
"io/ioutil"
"math"
"net/http"
"net/url"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/googleapi"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
"google.golang.org/api/option/internaloption"
httptransport "google.golang.org/api/transport/http"
computepb "google.golang.org/genproto/googleapis/cloud/compute/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
)
var newRegionSslPoliciesClientHook clientHook
// RegionSslPoliciesCallOptions contains the retry settings for each method of RegionSslPoliciesClient.
type RegionSslPoliciesCallOptions struct {
Delete []gax.CallOption
Get []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
ListAvailableFeatures []gax.CallOption
Patch []gax.CallOption
}
func defaultRegionSslPoliciesRESTCallOptions() *RegionSslPoliciesCallOptions {
return &RegionSslPoliciesCallOptions{
Delete: []gax.CallOption{},
Get: []gax.CallOption{},
Insert: []gax.CallOption{},
List: []gax.CallOption{},
ListAvailableFeatures: []gax.CallOption{},
Patch: []gax.CallOption{},
}
}
// internalRegionSslPoliciesClient is an interface that defines the methods available from Google Compute Engine API.
type internalRegionSslPoliciesClient interface {
Close() error
setGoogleClientInfo(...string)
Connection() *grpc.ClientConn
Delete(context.Context, *computepb.DeleteRegionSslPolicyRequest, ...gax.CallOption) (*Operation, error)
Get(context.Context, *computepb.GetRegionSslPolicyRequest, ...gax.CallOption) (*computepb.SslPolicy, error)
Insert(context.Context, *computepb.InsertRegionSslPolicyRequest, ...gax.CallOption) (*Operation, error)
List(context.Context, *computepb.ListRegionSslPoliciesRequest, ...gax.CallOption) *SslPolicyIterator
ListAvailableFeatures(context.Context, *computepb.ListAvailableFeaturesRegionSslPoliciesRequest, ...gax.CallOption) (*computepb.SslPoliciesListAvailableFeaturesResponse, error)
Patch(context.Context, *computepb.PatchRegionSslPolicyRequest, ...gax.CallOption) (*Operation, error)
}
// RegionSslPoliciesClient is a client for interacting with Google Compute Engine API.
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
//
// The RegionSslPolicies API.
type RegionSslPoliciesClient struct {
// The internal transport-dependent client.
internalClient internalRegionSslPoliciesClient
// The call options for this service.
CallOptions *RegionSslPoliciesCallOptions
}
// Wrapper methods routed to the internal client.
// Close closes the connection to the API service. The user should invoke this when
// the client is no longer required.
func (c *RegionSslPoliciesClient) Close() error {
return c.internalClient.Close()
}
// setGoogleClientInfo sets the name and version of the application in
// the `x-goog-api-client` header passed on each request. Intended for
// use by Google-written clients.
func (c *RegionSslPoliciesClient) setGoogleClientInfo(keyval ...string) {
c.internalClient.setGoogleClientInfo(keyval...)
}
// Connection returns a connection to the API service.
//
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionSslPoliciesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
// Delete deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in use by any TargetHttpsProxy or TargetSslProxy resources.
func (c *RegionSslPoliciesClient) Delete(ctx context.Context, req *computepb.DeleteRegionSslPolicyRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.Delete(ctx, req, opts...)
}
// Get lists all of the ordered rules present in a single specified policy.
func (c *RegionSslPoliciesClient) Get(ctx context.Context, req *computepb.GetRegionSslPolicyRequest, opts ...gax.CallOption) (*computepb.SslPolicy, error) {
return c.internalClient.Get(ctx, req, opts...)
}
// Insert creates a new policy in the specified project and region using the data included in the request.
func (c *RegionSslPoliciesClient) Insert(ctx context.Context, req *computepb.InsertRegionSslPolicyRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.Insert(ctx, req, opts...)
}
// List lists all the SSL policies that have been configured for the specified project and region.
func (c *RegionSslPoliciesClient) List(ctx context.Context, req *computepb.ListRegionSslPoliciesRequest, opts ...gax.CallOption) *SslPolicyIterator {
return c.internalClient.List(ctx, req, opts...)
}
// ListAvailableFeatures lists all features that can be specified in the SSL policy when using custom profile.
func (c *RegionSslPoliciesClient) ListAvailableFeatures(ctx context.Context, req *computepb.ListAvailableFeaturesRegionSslPoliciesRequest, opts ...gax.CallOption) (*computepb.SslPoliciesListAvailableFeaturesResponse, error) {
return c.internalClient.ListAvailableFeatures(ctx, req, opts...)
}
// Patch patches the specified SSL policy with the data included in the request.
func (c *RegionSslPoliciesClient) Patch(ctx context.Context, req *computepb.PatchRegionSslPolicyRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.Patch(ctx, req, opts...)
}
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type regionSslPoliciesRESTClient struct {
// The http endpoint to connect to.
endpoint string
// The http client.
httpClient *http.Client
// operationClient is used to call the operation-specific management service.
operationClient *RegionOperationsClient
// The x-goog-* metadata to be sent with each request.
xGoogMetadata metadata.MD
// Points back to the CallOptions field of the containing RegionSslPoliciesClient
CallOptions **RegionSslPoliciesCallOptions
}
// NewRegionSslPoliciesRESTClient creates a new region ssl policies rest client.
//
// The RegionSslPolicies API.
func NewRegionSslPoliciesRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionSslPoliciesClient, error) {
clientOpts := append(defaultRegionSslPoliciesRESTClientOptions(), opts...)
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
if err != nil {
return nil, err
}
callOpts := defaultRegionSslPoliciesRESTCallOptions()
c := &regionSslPoliciesRESTClient{
endpoint: endpoint,
httpClient: httpClient,
CallOptions: &callOpts,
}
c.setGoogleClientInfo()
o := []option.ClientOption{
option.WithHTTPClient(httpClient),
option.WithEndpoint(endpoint),
}
opC, err := NewRegionOperationsRESTClient(ctx, o...)
if err != nil {
return nil, err
}
c.operationClient = opC
return &RegionSslPoliciesClient{internalClient: c, CallOptions: callOpts}, nil
}
func defaultRegionSslPoliciesRESTClientOptions() []option.ClientOption {
return []option.ClientOption{
internaloption.WithDefaultEndpoint("https://compute.googleapis.com"),
internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"),
internaloption.WithDefaultAudience("https://compute.googleapis.com/"),
internaloption.WithDefaultScopes(DefaultAuthScopes()...),
}
}
// setGoogleClientInfo sets the name and version of the application in
// the `x-goog-api-client` header passed on each request. Intended for
// use by Google-written clients.
func (c *regionSslPoliciesRESTClient) setGoogleClientInfo(keyval ...string) {
kv := append([]string{"gl-go", versionGo()}, keyval...)
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN")
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
}
// Close closes the connection to the API service. The user should invoke this when
// the client is no longer required.
func (c *regionSslPoliciesRESTClient) Close() error {
// Replace httpClient with nil to force cleanup.
c.httpClient = nil
if err := c.operationClient.Close(); err != nil {
return err
}
return nil
}
// Connection returns a connection to the API service.
//
// Deprecated: This method always returns nil.
func (c *regionSslPoliciesRESTClient) Connection() *grpc.ClientConn {
return nil
}
// Delete deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in use by any TargetHttpsProxy or TargetSslProxy resources.
func (c *regionSslPoliciesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionSslPolicyRequest, opts ...gax.CallOption) (*Operation, error) {
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslPolicies/%v", req.GetProject(), req.GetRegion(), req.GetSslPolicy())
params := url.Values{}
if req != nil && req.RequestId != nil {
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion()), "ssl_policy", url.QueryEscape(req.GetSslPolicy())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).Delete[0:len((*c.CallOptions).Delete):len((*c.CallOptions).Delete)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Operation{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
op := &Operation{
&regionOperationsHandle{
c: c.operationClient,
proto: resp,
project: req.GetProject(),
region: req.GetRegion(),
},
}
return op, nil
}
// Get lists all of the ordered rules present in a single specified policy.
func (c *regionSslPoliciesRESTClient) Get(ctx context.Context, req *computepb.GetRegionSslPolicyRequest, opts ...gax.CallOption) (*computepb.SslPolicy, error) {
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslPolicies/%v", req.GetProject(), req.GetRegion(), req.GetSslPolicy())
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion()), "ssl_policy", url.QueryEscape(req.GetSslPolicy())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).Get[0:len((*c.CallOptions).Get):len((*c.CallOptions).Get)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.SslPolicy{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
return resp, nil
}
// Insert creates a new policy in the specified project and region using the data included in the request.
func (c *regionSslPoliciesRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionSslPolicyRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}
body := req.GetSslPolicyResource()
jsonReq, err := m.Marshal(body)
if err != nil {
return nil, err
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslPolicies", req.GetProject(), req.GetRegion())
params := url.Values{}
if req != nil && req.RequestId != nil {
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).Insert[0:len((*c.CallOptions).Insert):len((*c.CallOptions).Insert)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Operation{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
op := &Operation{
&regionOperationsHandle{
c: c.operationClient,
proto: resp,
project: req.GetProject(),
region: req.GetRegion(),
},
}
return op, nil
}
// List lists all the SSL policies that have been configured for the specified project and region.
func (c *regionSslPoliciesRESTClient) List(ctx context.Context, req *computepb.ListRegionSslPoliciesRequest, opts ...gax.CallOption) *SslPolicyIterator {
it := &SslPolicyIterator{}
req = proto.Clone(req).(*computepb.ListRegionSslPoliciesRequest)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
it.InternalFetch = func(pageSize int, pageToken string) ([]*computepb.SslPolicy, string, error) {
resp := &computepb.SslPoliciesList{}
if pageToken != "" {
req.PageToken = proto.String(pageToken)
}
if pageSize > math.MaxInt32 {
req.MaxResults = proto.Uint32(math.MaxInt32)
} else if pageSize != 0 {
req.MaxResults = proto.Uint32(uint32(pageSize))
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, "", err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslPolicies", req.GetProject(), req.GetRegion())
params := url.Values{}
if req != nil && req.Filter != nil {
params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
}
if req != nil && req.MaxResults != nil {
params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults()))
}
if req != nil && req.OrderBy != nil {
params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
}
if req != nil && req.PageToken != nil {
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
}
if req != nil && req.ReturnPartialSuccess != nil {
params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
headers := buildHeaders(ctx, c.xGoogMetadata, metadata.Pairs("Content-Type", "application/json"))
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
if err != nil {
return err
}
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, "", e
}
it.Response = resp
return resp.GetItems(), resp.GetNextPageToken(), nil
}
fetch := func(pageSize int, pageToken string) (string, error) {
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
if err != nil {
return "", err
}
it.items = append(it.items, items...)
return nextPageToken, nil
}
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
it.pageInfo.MaxSize = int(req.GetMaxResults())
it.pageInfo.Token = req.GetPageToken()
return it
}
// ListAvailableFeatures lists all features that can be specified in the SSL policy when using custom profile.
func (c *regionSslPoliciesRESTClient) ListAvailableFeatures(ctx context.Context, req *computepb.ListAvailableFeaturesRegionSslPoliciesRequest, opts ...gax.CallOption) (*computepb.SslPoliciesListAvailableFeaturesResponse, error) {
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslPolicies/listAvailableFeatures", req.GetProject(), req.GetRegion())
params := url.Values{}
if req != nil && req.Filter != nil {
params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
}
if req != nil && req.MaxResults != nil {
params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults()))
}
if req != nil && req.OrderBy != nil {
params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
}
if req != nil && req.PageToken != nil {
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
}
if req != nil && req.ReturnPartialSuccess != nil {
params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).ListAvailableFeatures[0:len((*c.CallOptions).ListAvailableFeatures):len((*c.CallOptions).ListAvailableFeatures)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.SslPoliciesListAvailableFeaturesResponse{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
return resp, nil
}
// Patch patches the specified SSL policy with the data included in the request.
func (c *regionSslPoliciesRESTClient) Patch(ctx context.Context, req *computepb.PatchRegionSslPolicyRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}
body := req.GetSslPolicyResource()
jsonReq, err := m.Marshal(body)
if err != nil {
return nil, err
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslPolicies/%v", req.GetProject(), req.GetRegion(), req.GetSslPolicy())
params := url.Values{}
if req != nil && req.RequestId != nil {
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion()), "ssl_policy", url.QueryEscape(req.GetSslPolicy())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).Patch[0:len((*c.CallOptions).Patch):len((*c.CallOptions).Patch)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Operation{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("PATCH", baseUrl.String(), bytes.NewReader(jsonReq))
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
op := &Operation{
&regionOperationsHandle{
c: c.operationClient,
proto: resp,
project: req.GetProject(),
region: req.GetRegion(),
},
}
return op, nil
}
// SslPolicyIterator manages a stream of *computepb.SslPolicy.
type SslPolicyIterator struct {
items []*computepb.SslPolicy
pageInfo *iterator.PageInfo
nextFunc func() error
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*computepb.SslPolicy, nextPageToken string, err error)
}
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
func (it *SslPolicyIterator) PageInfo() *iterator.PageInfo {
return it.pageInfo
}
// Next returns the next result. Its second return value is iterator.Done if there are no more
// results. Once Next returns Done, all subsequent calls will return Done.
func (it *SslPolicyIterator) Next() (*computepb.SslPolicy, error) {
var item *computepb.SslPolicy
if err := it.nextFunc(); err != nil {
return item, err
}
item = it.items[0]
it.items = it.items[1:]
return item, nil
}
func (it *SslPolicyIterator) bufLen() int {
return len(it.items)
}
func (it *SslPolicyIterator) takeBuf() interface{} {
b := it.items
it.items = nil
return b
}

View file

@ -100,7 +100,8 @@ func (c *RegionTargetHttpProxiesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionTargetHttpProxiesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -210,7 +211,7 @@ func (c *regionTargetHttpProxiesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionTargetHttpProxiesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -106,7 +106,8 @@ func (c *RegionTargetHttpsProxiesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionTargetHttpsProxiesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -226,7 +227,7 @@ func (c *regionTargetHttpsProxiesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionTargetHttpsProxiesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -0,0 +1,548 @@
// Copyright 2022 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Code generated by protoc-gen-go_gapic. DO NOT EDIT.
package compute
import (
"bytes"
"context"
"fmt"
"io/ioutil"
"math"
"net/http"
"net/url"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/googleapi"
"google.golang.org/api/iterator"
"google.golang.org/api/option"
"google.golang.org/api/option/internaloption"
httptransport "google.golang.org/api/transport/http"
computepb "google.golang.org/genproto/googleapis/cloud/compute/v1"
"google.golang.org/grpc"
"google.golang.org/grpc/metadata"
"google.golang.org/protobuf/encoding/protojson"
"google.golang.org/protobuf/proto"
)
var newRegionTargetTcpProxiesClientHook clientHook
// RegionTargetTcpProxiesCallOptions contains the retry settings for each method of RegionTargetTcpProxiesClient.
type RegionTargetTcpProxiesCallOptions struct {
Delete []gax.CallOption
Get []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
}
func defaultRegionTargetTcpProxiesRESTCallOptions() *RegionTargetTcpProxiesCallOptions {
return &RegionTargetTcpProxiesCallOptions{
Delete: []gax.CallOption{},
Get: []gax.CallOption{},
Insert: []gax.CallOption{},
List: []gax.CallOption{},
}
}
// internalRegionTargetTcpProxiesClient is an interface that defines the methods available from Google Compute Engine API.
type internalRegionTargetTcpProxiesClient interface {
Close() error
setGoogleClientInfo(...string)
Connection() *grpc.ClientConn
Delete(context.Context, *computepb.DeleteRegionTargetTcpProxyRequest, ...gax.CallOption) (*Operation, error)
Get(context.Context, *computepb.GetRegionTargetTcpProxyRequest, ...gax.CallOption) (*computepb.TargetTcpProxy, error)
Insert(context.Context, *computepb.InsertRegionTargetTcpProxyRequest, ...gax.CallOption) (*Operation, error)
List(context.Context, *computepb.ListRegionTargetTcpProxiesRequest, ...gax.CallOption) *TargetTcpProxyIterator
}
// RegionTargetTcpProxiesClient is a client for interacting with Google Compute Engine API.
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
//
// The RegionTargetTcpProxies API.
type RegionTargetTcpProxiesClient struct {
// The internal transport-dependent client.
internalClient internalRegionTargetTcpProxiesClient
// The call options for this service.
CallOptions *RegionTargetTcpProxiesCallOptions
}
// Wrapper methods routed to the internal client.
// Close closes the connection to the API service. The user should invoke this when
// the client is no longer required.
func (c *RegionTargetTcpProxiesClient) Close() error {
return c.internalClient.Close()
}
// setGoogleClientInfo sets the name and version of the application in
// the `x-goog-api-client` header passed on each request. Intended for
// use by Google-written clients.
func (c *RegionTargetTcpProxiesClient) setGoogleClientInfo(keyval ...string) {
c.internalClient.setGoogleClientInfo(keyval...)
}
// Connection returns a connection to the API service.
//
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionTargetTcpProxiesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
// Delete deletes the specified TargetTcpProxy resource.
func (c *RegionTargetTcpProxiesClient) Delete(ctx context.Context, req *computepb.DeleteRegionTargetTcpProxyRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.Delete(ctx, req, opts...)
}
// Get returns the specified TargetTcpProxy resource.
func (c *RegionTargetTcpProxiesClient) Get(ctx context.Context, req *computepb.GetRegionTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.TargetTcpProxy, error) {
return c.internalClient.Get(ctx, req, opts...)
}
// Insert creates a TargetTcpProxy resource in the specified project and region using the data included in the request.
func (c *RegionTargetTcpProxiesClient) Insert(ctx context.Context, req *computepb.InsertRegionTargetTcpProxyRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.Insert(ctx, req, opts...)
}
// List retrieves a list of TargetTcpProxy resources available to the specified project in a given region.
func (c *RegionTargetTcpProxiesClient) List(ctx context.Context, req *computepb.ListRegionTargetTcpProxiesRequest, opts ...gax.CallOption) *TargetTcpProxyIterator {
return c.internalClient.List(ctx, req, opts...)
}
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type regionTargetTcpProxiesRESTClient struct {
// The http endpoint to connect to.
endpoint string
// The http client.
httpClient *http.Client
// operationClient is used to call the operation-specific management service.
operationClient *RegionOperationsClient
// The x-goog-* metadata to be sent with each request.
xGoogMetadata metadata.MD
// Points back to the CallOptions field of the containing RegionTargetTcpProxiesClient
CallOptions **RegionTargetTcpProxiesCallOptions
}
// NewRegionTargetTcpProxiesRESTClient creates a new region target tcp proxies rest client.
//
// The RegionTargetTcpProxies API.
func NewRegionTargetTcpProxiesRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegionTargetTcpProxiesClient, error) {
clientOpts := append(defaultRegionTargetTcpProxiesRESTClientOptions(), opts...)
httpClient, endpoint, err := httptransport.NewClient(ctx, clientOpts...)
if err != nil {
return nil, err
}
callOpts := defaultRegionTargetTcpProxiesRESTCallOptions()
c := &regionTargetTcpProxiesRESTClient{
endpoint: endpoint,
httpClient: httpClient,
CallOptions: &callOpts,
}
c.setGoogleClientInfo()
o := []option.ClientOption{
option.WithHTTPClient(httpClient),
option.WithEndpoint(endpoint),
}
opC, err := NewRegionOperationsRESTClient(ctx, o...)
if err != nil {
return nil, err
}
c.operationClient = opC
return &RegionTargetTcpProxiesClient{internalClient: c, CallOptions: callOpts}, nil
}
func defaultRegionTargetTcpProxiesRESTClientOptions() []option.ClientOption {
return []option.ClientOption{
internaloption.WithDefaultEndpoint("https://compute.googleapis.com"),
internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"),
internaloption.WithDefaultAudience("https://compute.googleapis.com/"),
internaloption.WithDefaultScopes(DefaultAuthScopes()...),
}
}
// setGoogleClientInfo sets the name and version of the application in
// the `x-goog-api-client` header passed on each request. Intended for
// use by Google-written clients.
func (c *regionTargetTcpProxiesRESTClient) setGoogleClientInfo(keyval ...string) {
kv := append([]string{"gl-go", versionGo()}, keyval...)
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN")
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
}
// Close closes the connection to the API service. The user should invoke this when
// the client is no longer required.
func (c *regionTargetTcpProxiesRESTClient) Close() error {
// Replace httpClient with nil to force cleanup.
c.httpClient = nil
if err := c.operationClient.Close(); err != nil {
return err
}
return nil
}
// Connection returns a connection to the API service.
//
// Deprecated: This method always returns nil.
func (c *regionTargetTcpProxiesRESTClient) Connection() *grpc.ClientConn {
return nil
}
// Delete deletes the specified TargetTcpProxy resource.
func (c *regionTargetTcpProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionTargetTcpProxyRequest, opts ...gax.CallOption) (*Operation, error) {
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetTcpProxies/%v", req.GetProject(), req.GetRegion(), req.GetTargetTcpProxy())
params := url.Values{}
if req != nil && req.RequestId != nil {
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion()), "target_tcp_proxy", url.QueryEscape(req.GetTargetTcpProxy())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).Delete[0:len((*c.CallOptions).Delete):len((*c.CallOptions).Delete)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Operation{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil)
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
op := &Operation{
&regionOperationsHandle{
c: c.operationClient,
proto: resp,
project: req.GetProject(),
region: req.GetRegion(),
},
}
return op, nil
}
// Get returns the specified TargetTcpProxy resource.
func (c *regionTargetTcpProxiesRESTClient) Get(ctx context.Context, req *computepb.GetRegionTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.TargetTcpProxy, error) {
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetTcpProxies/%v", req.GetProject(), req.GetRegion(), req.GetTargetTcpProxy())
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion()), "target_tcp_proxy", url.QueryEscape(req.GetTargetTcpProxy())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).Get[0:len((*c.CallOptions).Get):len((*c.CallOptions).Get)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.TargetTcpProxy{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
return resp, nil
}
// Insert creates a TargetTcpProxy resource in the specified project and region using the data included in the request.
func (c *regionTargetTcpProxiesRESTClient) Insert(ctx context.Context, req *computepb.InsertRegionTargetTcpProxyRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}
body := req.GetTargetTcpProxyResource()
jsonReq, err := m.Marshal(body)
if err != nil {
return nil, err
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetTcpProxies", req.GetProject(), req.GetRegion())
params := url.Values{}
if req != nil && req.RequestId != nil {
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).Insert[0:len((*c.CallOptions).Insert):len((*c.CallOptions).Insert)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Operation{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
op := &Operation{
&regionOperationsHandle{
c: c.operationClient,
proto: resp,
project: req.GetProject(),
region: req.GetRegion(),
},
}
return op, nil
}
// List retrieves a list of TargetTcpProxy resources available to the specified project in a given region.
func (c *regionTargetTcpProxiesRESTClient) List(ctx context.Context, req *computepb.ListRegionTargetTcpProxiesRequest, opts ...gax.CallOption) *TargetTcpProxyIterator {
it := &TargetTcpProxyIterator{}
req = proto.Clone(req).(*computepb.ListRegionTargetTcpProxiesRequest)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
it.InternalFetch = func(pageSize int, pageToken string) ([]*computepb.TargetTcpProxy, string, error) {
resp := &computepb.TargetTcpProxyList{}
if pageToken != "" {
req.PageToken = proto.String(pageToken)
}
if pageSize > math.MaxInt32 {
req.MaxResults = proto.Uint32(math.MaxInt32)
} else if pageSize != 0 {
req.MaxResults = proto.Uint32(uint32(pageSize))
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, "", err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetTcpProxies", req.GetProject(), req.GetRegion())
params := url.Values{}
if req != nil && req.Filter != nil {
params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
}
if req != nil && req.MaxResults != nil {
params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults()))
}
if req != nil && req.OrderBy != nil {
params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
}
if req != nil && req.PageToken != nil {
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
}
if req != nil && req.ReturnPartialSuccess != nil {
params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
headers := buildHeaders(ctx, c.xGoogMetadata, metadata.Pairs("Content-Type", "application/json"))
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
if err != nil {
return err
}
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, "", e
}
it.Response = resp
return resp.GetItems(), resp.GetNextPageToken(), nil
}
fetch := func(pageSize int, pageToken string) (string, error) {
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
if err != nil {
return "", err
}
it.items = append(it.items, items...)
return nextPageToken, nil
}
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
it.pageInfo.MaxSize = int(req.GetMaxResults())
it.pageInfo.Token = req.GetPageToken()
return it
}
// TargetTcpProxyIterator manages a stream of *computepb.TargetTcpProxy.
type TargetTcpProxyIterator struct {
items []*computepb.TargetTcpProxy
pageInfo *iterator.PageInfo
nextFunc func() error
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*computepb.TargetTcpProxy, nextPageToken string, err error)
}
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
func (it *TargetTcpProxyIterator) PageInfo() *iterator.PageInfo {
return it.pageInfo
}
// Next returns the next result. Its second return value is iterator.Done if there are no more
// results. Once Next returns Done, all subsequent calls will return Done.
func (it *TargetTcpProxyIterator) Next() (*computepb.TargetTcpProxy, error) {
var item *computepb.TargetTcpProxy
if err := it.nextFunc(); err != nil {
return item, err
}
item = it.items[0]
it.items = it.items[1:]
return item, nil
}
func (it *TargetTcpProxyIterator) bufLen() int {
return len(it.items)
}
func (it *TargetTcpProxyIterator) takeBuf() interface{} {
b := it.items
it.items = nil
return b
}

View file

@ -106,7 +106,8 @@ func (c *RegionUrlMapsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionUrlMapsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -226,7 +227,7 @@ func (c *regionUrlMapsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionUrlMapsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -90,7 +90,8 @@ func (c *RegionsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RegionsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -169,7 +170,7 @@ func (c *regionsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *regionsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -116,7 +116,8 @@ func (c *ReservationsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *ReservationsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -251,7 +252,7 @@ func (c *reservationsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *reservationsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -110,7 +110,8 @@ func (c *ResourcePoliciesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *ResourcePoliciesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -235,7 +236,7 @@ func (c *resourcePoliciesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *resourcePoliciesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -116,7 +116,8 @@ func (c *RoutersClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RoutersClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -251,7 +252,7 @@ func (c *routersRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *routersRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -97,7 +97,8 @@ func (c *RoutesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *RoutesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -202,7 +203,7 @@ func (c *routesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *routesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -54,6 +54,7 @@ type SecurityPoliciesCallOptions struct {
Patch []gax.CallOption
PatchRule []gax.CallOption
RemoveRule []gax.CallOption
SetLabels []gax.CallOption
}
func defaultSecurityPoliciesRESTCallOptions() *SecurityPoliciesCallOptions {
@ -69,6 +70,7 @@ func defaultSecurityPoliciesRESTCallOptions() *SecurityPoliciesCallOptions {
Patch: []gax.CallOption{},
PatchRule: []gax.CallOption{},
RemoveRule: []gax.CallOption{},
SetLabels: []gax.CallOption{},
}
}
@ -88,6 +90,7 @@ type internalSecurityPoliciesClient interface {
Patch(context.Context, *computepb.PatchSecurityPolicyRequest, ...gax.CallOption) (*Operation, error)
PatchRule(context.Context, *computepb.PatchRuleSecurityPolicyRequest, ...gax.CallOption) (*Operation, error)
RemoveRule(context.Context, *computepb.RemoveRuleSecurityPolicyRequest, ...gax.CallOption) (*Operation, error)
SetLabels(context.Context, *computepb.SetLabelsSecurityPolicyRequest, ...gax.CallOption) (*Operation, error)
}
// SecurityPoliciesClient is a client for interacting with Google Compute Engine API.
@ -119,7 +122,8 @@ func (c *SecurityPoliciesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *SecurityPoliciesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -179,6 +183,11 @@ func (c *SecurityPoliciesClient) RemoveRule(ctx context.Context, req *computepb.
return c.internalClient.RemoveRule(ctx, req, opts...)
}
// SetLabels sets the labels on a security policy. To learn more about labels, read the Labeling Resources documentation.
func (c *SecurityPoliciesClient) SetLabels(ctx context.Context, req *computepb.SetLabelsSecurityPolicyRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.SetLabels(ctx, req, opts...)
}
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type securityPoliciesRESTClient struct {
// The http endpoint to connect to.
@ -259,7 +268,7 @@ func (c *securityPoliciesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *securityPoliciesRESTClient) Connection() *grpc.ClientConn {
return nil
}
@ -1087,6 +1096,73 @@ func (c *securityPoliciesRESTClient) RemoveRule(ctx context.Context, req *comput
return op, nil
}
// SetLabels sets the labels on a security policy. To learn more about labels, read the Labeling Resources documentation.
func (c *securityPoliciesRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsSecurityPolicyRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}
body := req.GetGlobalSetLabelsRequestResource()
jsonReq, err := m.Marshal(body)
if err != nil {
return nil, err
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/%v/setLabels", req.GetProject(), req.GetResource())
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "resource", url.QueryEscape(req.GetResource())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).SetLabels[0:len((*c.CallOptions).SetLabels):len((*c.CallOptions).SetLabels)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Operation{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
op := &Operation{
&globalOperationsHandle{
c: c.operationClient,
proto: resp,
project: req.GetProject(),
},
}
return op, nil
}
// SecurityPoliciesScopedListPair is a holder type for string/*computepb.SecurityPoliciesScopedList map entries
type SecurityPoliciesScopedListPair struct {
Key string

View file

@ -113,7 +113,8 @@ func (c *ServiceAttachmentsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *ServiceAttachmentsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -243,7 +244,7 @@ func (c *serviceAttachmentsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *serviceAttachmentsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -109,7 +109,8 @@ func (c *SnapshotsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *SnapshotsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -234,7 +235,7 @@ func (c *snapshotsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *snapshotsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -101,7 +101,8 @@ func (c *SslCertificatesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *SslCertificatesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -211,7 +212,7 @@ func (c *sslCertificatesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *sslCertificatesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -24,6 +24,7 @@ import (
"math"
"net/http"
"net/url"
"sort"
gax "github.com/googleapis/gax-go/v2"
"google.golang.org/api/googleapi"
@ -42,6 +43,7 @@ var newSslPoliciesClientHook clientHook
// SslPoliciesCallOptions contains the retry settings for each method of SslPoliciesClient.
type SslPoliciesCallOptions struct {
AggregatedList []gax.CallOption
Delete []gax.CallOption
Get []gax.CallOption
Insert []gax.CallOption
@ -52,6 +54,7 @@ type SslPoliciesCallOptions struct {
func defaultSslPoliciesRESTCallOptions() *SslPoliciesCallOptions {
return &SslPoliciesCallOptions{
AggregatedList: []gax.CallOption{},
Delete: []gax.CallOption{},
Get: []gax.CallOption{},
Insert: []gax.CallOption{},
@ -66,6 +69,7 @@ type internalSslPoliciesClient interface {
Close() error
setGoogleClientInfo(...string)
Connection() *grpc.ClientConn
AggregatedList(context.Context, *computepb.AggregatedListSslPoliciesRequest, ...gax.CallOption) *SslPoliciesScopedListPairIterator
Delete(context.Context, *computepb.DeleteSslPolicyRequest, ...gax.CallOption) (*Operation, error)
Get(context.Context, *computepb.GetSslPolicyRequest, ...gax.CallOption) (*computepb.SslPolicy, error)
Insert(context.Context, *computepb.InsertSslPolicyRequest, ...gax.CallOption) (*Operation, error)
@ -103,11 +107,17 @@ func (c *SslPoliciesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *SslPoliciesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
// AggregatedList retrieves the list of all SslPolicy resources, regional and global, available to the specified project.
func (c *SslPoliciesClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListSslPoliciesRequest, opts ...gax.CallOption) *SslPoliciesScopedListPairIterator {
return c.internalClient.AggregatedList(ctx, req, opts...)
}
// Delete deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in use by any TargetHttpsProxy or TargetSslProxy resources.
func (c *SslPoliciesClient) Delete(ctx context.Context, req *computepb.DeleteSslPolicyRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.Delete(ctx, req, opts...)
@ -218,11 +228,117 @@ func (c *sslPoliciesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *sslPoliciesRESTClient) Connection() *grpc.ClientConn {
return nil
}
// AggregatedList retrieves the list of all SslPolicy resources, regional and global, available to the specified project.
func (c *sslPoliciesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListSslPoliciesRequest, opts ...gax.CallOption) *SslPoliciesScopedListPairIterator {
it := &SslPoliciesScopedListPairIterator{}
req = proto.Clone(req).(*computepb.AggregatedListSslPoliciesRequest)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
it.InternalFetch = func(pageSize int, pageToken string) ([]SslPoliciesScopedListPair, string, error) {
resp := &computepb.SslPoliciesAggregatedList{}
if pageToken != "" {
req.PageToken = proto.String(pageToken)
}
if pageSize > math.MaxInt32 {
req.MaxResults = proto.Uint32(math.MaxInt32)
} else if pageSize != 0 {
req.MaxResults = proto.Uint32(uint32(pageSize))
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, "", err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/sslPolicies", req.GetProject())
params := url.Values{}
if req != nil && req.Filter != nil {
params.Add("filter", fmt.Sprintf("%v", req.GetFilter()))
}
if req != nil && req.IncludeAllScopes != nil {
params.Add("includeAllScopes", fmt.Sprintf("%v", req.GetIncludeAllScopes()))
}
if req != nil && req.MaxResults != nil {
params.Add("maxResults", fmt.Sprintf("%v", req.GetMaxResults()))
}
if req != nil && req.OrderBy != nil {
params.Add("orderBy", fmt.Sprintf("%v", req.GetOrderBy()))
}
if req != nil && req.PageToken != nil {
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
}
if req != nil && req.ReturnPartialSuccess != nil {
params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
headers := buildHeaders(ctx, c.xGoogMetadata, metadata.Pairs("Content-Type", "application/json"))
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("GET", baseUrl.String(), nil)
if err != nil {
return err
}
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, "", e
}
it.Response = resp
elems := make([]SslPoliciesScopedListPair, 0, len(resp.GetItems()))
for k, v := range resp.GetItems() {
elems = append(elems, SslPoliciesScopedListPair{k, v})
}
sort.Slice(elems, func(i, j int) bool { return elems[i].Key < elems[j].Key })
return elems, resp.GetNextPageToken(), nil
}
fetch := func(pageSize int, pageToken string) (string, error) {
items, nextPageToken, err := it.InternalFetch(pageSize, pageToken)
if err != nil {
return "", err
}
it.items = append(it.items, items...)
return nextPageToken, nil
}
it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf)
it.pageInfo.MaxSize = int(req.GetMaxResults())
it.pageInfo.Token = req.GetPageToken()
return it
}
// Delete deletes the specified SSL policy. The SSL policy resource can be deleted only if it is not in use by any TargetHttpsProxy or TargetSslProxy resources.
func (c *sslPoliciesRESTClient) Delete(ctx context.Context, req *computepb.DeleteSslPolicyRequest, opts ...gax.CallOption) (*Operation, error) {
baseUrl, err := url.Parse(c.endpoint)
@ -659,9 +775,15 @@ func (c *sslPoliciesRESTClient) Patch(ctx context.Context, req *computepb.PatchS
return op, nil
}
// SslPolicyIterator manages a stream of *computepb.SslPolicy.
type SslPolicyIterator struct {
items []*computepb.SslPolicy
// SslPoliciesScopedListPair is a holder type for string/*computepb.SslPoliciesScopedList map entries
type SslPoliciesScopedListPair struct {
Key string
Value *computepb.SslPoliciesScopedList
}
// SslPoliciesScopedListPairIterator manages a stream of SslPoliciesScopedListPair.
type SslPoliciesScopedListPairIterator struct {
items []SslPoliciesScopedListPair
pageInfo *iterator.PageInfo
nextFunc func() error
@ -676,18 +798,18 @@ type SslPolicyIterator struct {
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*computepb.SslPolicy, nextPageToken string, err error)
InternalFetch func(pageSize int, pageToken string) (results []SslPoliciesScopedListPair, nextPageToken string, err error)
}
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
func (it *SslPolicyIterator) PageInfo() *iterator.PageInfo {
func (it *SslPoliciesScopedListPairIterator) PageInfo() *iterator.PageInfo {
return it.pageInfo
}
// Next returns the next result. Its second return value is iterator.Done if there are no more
// results. Once Next returns Done, all subsequent calls will return Done.
func (it *SslPolicyIterator) Next() (*computepb.SslPolicy, error) {
var item *computepb.SslPolicy
func (it *SslPoliciesScopedListPairIterator) Next() (SslPoliciesScopedListPair, error) {
var item SslPoliciesScopedListPair
if err := it.nextFunc(); err != nil {
return item, err
}
@ -696,11 +818,11 @@ func (it *SslPolicyIterator) Next() (*computepb.SslPolicy, error) {
return item, nil
}
func (it *SslPolicyIterator) bufLen() int {
func (it *SslPoliciesScopedListPairIterator) bufLen() int {
return len(it.items)
}
func (it *SslPolicyIterator) takeBuf() interface{} {
func (it *SslPoliciesScopedListPairIterator) takeBuf() interface{} {
b := it.items
it.items = nil
return b

View file

@ -122,7 +122,8 @@ func (c *SubnetworksClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *SubnetworksClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -267,7 +268,7 @@ func (c *subnetworksRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *subnetworksRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -100,7 +100,8 @@ func (c *TargetGrpcProxiesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *TargetGrpcProxiesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -210,7 +211,7 @@ func (c *targetGrpcProxiesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *targetGrpcProxiesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -107,7 +107,8 @@ func (c *TargetHttpProxiesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *TargetHttpProxiesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -227,7 +228,7 @@ func (c *targetHttpProxiesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *targetHttpProxiesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -119,7 +119,8 @@ func (c *TargetHttpsProxiesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *TargetHttpsProxiesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -259,7 +260,7 @@ func (c *targetHttpsProxiesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *targetHttpsProxiesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -101,7 +101,8 @@ func (c *TargetInstancesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *TargetInstancesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -211,7 +212,7 @@ func (c *targetInstancesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *targetInstancesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -119,7 +119,8 @@ func (c *TargetPoolsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *TargetPoolsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -259,7 +260,7 @@ func (c *targetPoolsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *targetPoolsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -112,7 +112,8 @@ func (c *TargetSslProxiesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *TargetSslProxiesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -242,7 +243,7 @@ func (c *targetSslProxiesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *targetSslProxiesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -103,7 +103,8 @@ func (c *TargetTcpProxiesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *TargetTcpProxiesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -218,7 +219,7 @@ func (c *targetTcpProxiesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *targetTcpProxiesRESTClient) Connection() *grpc.ClientConn {
return nil
}
@ -660,50 +661,3 @@ func (c *targetTcpProxiesRESTClient) SetProxyHeader(ctx context.Context, req *co
}
return op, nil
}
// TargetTcpProxyIterator manages a stream of *computepb.TargetTcpProxy.
type TargetTcpProxyIterator struct {
items []*computepb.TargetTcpProxy
pageInfo *iterator.PageInfo
nextFunc func() error
// Response is the raw response for the current page.
// It must be cast to the RPC response type.
// Calling Next() or InternalFetch() updates this value.
Response interface{}
// InternalFetch is for use by the Google Cloud Libraries only.
// It is not part of the stable interface of this package.
//
// InternalFetch returns results from a single call to the underlying RPC.
// The number of results is no greater than pageSize.
// If there are no more results, nextPageToken is empty and err is nil.
InternalFetch func(pageSize int, pageToken string) (results []*computepb.TargetTcpProxy, nextPageToken string, err error)
}
// PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
func (it *TargetTcpProxyIterator) PageInfo() *iterator.PageInfo {
return it.pageInfo
}
// Next returns the next result. Its second return value is iterator.Done if there are no more
// results. Once Next returns Done, all subsequent calls will return Done.
func (it *TargetTcpProxyIterator) Next() (*computepb.TargetTcpProxy, error) {
var item *computepb.TargetTcpProxy
if err := it.nextFunc(); err != nil {
return item, err
}
item = it.items[0]
it.items = it.items[1:]
return item, nil
}
func (it *TargetTcpProxyIterator) bufLen() int {
return len(it.items)
}
func (it *TargetTcpProxyIterator) takeBuf() interface{} {
b := it.items
it.items = nil
return b
}

View file

@ -48,6 +48,7 @@ type TargetVpnGatewaysCallOptions struct {
Get []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
SetLabels []gax.CallOption
}
func defaultTargetVpnGatewaysRESTCallOptions() *TargetVpnGatewaysCallOptions {
@ -57,6 +58,7 @@ func defaultTargetVpnGatewaysRESTCallOptions() *TargetVpnGatewaysCallOptions {
Get: []gax.CallOption{},
Insert: []gax.CallOption{},
List: []gax.CallOption{},
SetLabels: []gax.CallOption{},
}
}
@ -70,6 +72,7 @@ type internalTargetVpnGatewaysClient interface {
Get(context.Context, *computepb.GetTargetVpnGatewayRequest, ...gax.CallOption) (*computepb.TargetVpnGateway, error)
Insert(context.Context, *computepb.InsertTargetVpnGatewayRequest, ...gax.CallOption) (*Operation, error)
List(context.Context, *computepb.ListTargetVpnGatewaysRequest, ...gax.CallOption) *TargetVpnGatewayIterator
SetLabels(context.Context, *computepb.SetLabelsTargetVpnGatewayRequest, ...gax.CallOption) (*Operation, error)
}
// TargetVpnGatewaysClient is a client for interacting with Google Compute Engine API.
@ -101,7 +104,8 @@ func (c *TargetVpnGatewaysClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *TargetVpnGatewaysClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -131,6 +135,11 @@ func (c *TargetVpnGatewaysClient) List(ctx context.Context, req *computepb.ListT
return c.internalClient.List(ctx, req, opts...)
}
// SetLabels sets the labels on a TargetVpnGateway. To learn more about labels, read the Labeling Resources documentation.
func (c *TargetVpnGatewaysClient) SetLabels(ctx context.Context, req *computepb.SetLabelsTargetVpnGatewayRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.SetLabels(ctx, req, opts...)
}
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type targetVpnGatewaysRESTClient struct {
// The http endpoint to connect to.
@ -211,7 +220,7 @@ func (c *targetVpnGatewaysRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *targetVpnGatewaysRESTClient) Connection() *grpc.ClientConn {
return nil
}
@ -614,6 +623,81 @@ func (c *targetVpnGatewaysRESTClient) List(ctx context.Context, req *computepb.L
return it
}
// SetLabels sets the labels on a TargetVpnGateway. To learn more about labels, read the Labeling Resources documentation.
func (c *targetVpnGatewaysRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsTargetVpnGatewayRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}
body := req.GetRegionSetLabelsRequestResource()
jsonReq, err := m.Marshal(body)
if err != nil {
return nil, err
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetVpnGateways/%v/setLabels", req.GetProject(), req.GetRegion(), req.GetResource())
params := url.Values{}
if req != nil && req.RequestId != nil {
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion()), "resource", url.QueryEscape(req.GetResource())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).SetLabels[0:len((*c.CallOptions).SetLabels):len((*c.CallOptions).SetLabels)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Operation{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
op := &Operation{
&regionOperationsHandle{
c: c.operationClient,
proto: resp,
project: req.GetProject(),
region: req.GetRegion(),
},
}
return op, nil
}
// TargetVpnGatewayIterator manages a stream of *computepb.TargetVpnGateway.
type TargetVpnGatewayIterator struct {
items []*computepb.TargetVpnGateway

View file

@ -113,7 +113,8 @@ func (c *UrlMapsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *UrlMapsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -243,7 +244,7 @@ func (c *urlMapsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *urlMapsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -110,7 +110,8 @@ func (c *VpnGatewaysClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *VpnGatewaysClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -235,7 +236,7 @@ func (c *vpnGatewaysRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *vpnGatewaysRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -48,6 +48,7 @@ type VpnTunnelsCallOptions struct {
Get []gax.CallOption
Insert []gax.CallOption
List []gax.CallOption
SetLabels []gax.CallOption
}
func defaultVpnTunnelsRESTCallOptions() *VpnTunnelsCallOptions {
@ -57,6 +58,7 @@ func defaultVpnTunnelsRESTCallOptions() *VpnTunnelsCallOptions {
Get: []gax.CallOption{},
Insert: []gax.CallOption{},
List: []gax.CallOption{},
SetLabels: []gax.CallOption{},
}
}
@ -70,6 +72,7 @@ type internalVpnTunnelsClient interface {
Get(context.Context, *computepb.GetVpnTunnelRequest, ...gax.CallOption) (*computepb.VpnTunnel, error)
Insert(context.Context, *computepb.InsertVpnTunnelRequest, ...gax.CallOption) (*Operation, error)
List(context.Context, *computepb.ListVpnTunnelsRequest, ...gax.CallOption) *VpnTunnelIterator
SetLabels(context.Context, *computepb.SetLabelsVpnTunnelRequest, ...gax.CallOption) (*Operation, error)
}
// VpnTunnelsClient is a client for interacting with Google Compute Engine API.
@ -101,7 +104,8 @@ func (c *VpnTunnelsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *VpnTunnelsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -131,6 +135,11 @@ func (c *VpnTunnelsClient) List(ctx context.Context, req *computepb.ListVpnTunne
return c.internalClient.List(ctx, req, opts...)
}
// SetLabels sets the labels on a VpnTunnel. To learn more about labels, read the Labeling Resources documentation.
func (c *VpnTunnelsClient) SetLabels(ctx context.Context, req *computepb.SetLabelsVpnTunnelRequest, opts ...gax.CallOption) (*Operation, error) {
return c.internalClient.SetLabels(ctx, req, opts...)
}
// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
type vpnTunnelsRESTClient struct {
// The http endpoint to connect to.
@ -211,7 +220,7 @@ func (c *vpnTunnelsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *vpnTunnelsRESTClient) Connection() *grpc.ClientConn {
return nil
}
@ -614,6 +623,81 @@ func (c *vpnTunnelsRESTClient) List(ctx context.Context, req *computepb.ListVpnT
return it
}
// SetLabels sets the labels on a VpnTunnel. To learn more about labels, read the Labeling Resources documentation.
func (c *vpnTunnelsRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabelsVpnTunnelRequest, opts ...gax.CallOption) (*Operation, error) {
m := protojson.MarshalOptions{AllowPartial: true}
body := req.GetRegionSetLabelsRequestResource()
jsonReq, err := m.Marshal(body)
if err != nil {
return nil, err
}
baseUrl, err := url.Parse(c.endpoint)
if err != nil {
return nil, err
}
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnTunnels/%v/setLabels", req.GetProject(), req.GetRegion(), req.GetResource())
params := url.Values{}
if req != nil && req.RequestId != nil {
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
}
baseUrl.RawQuery = params.Encode()
// Build HTTP headers from client and context metadata.
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "region", url.QueryEscape(req.GetRegion()), "resource", url.QueryEscape(req.GetResource())))
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
opts = append((*c.CallOptions).SetLabels[0:len((*c.CallOptions).SetLabels):len((*c.CallOptions).SetLabels)], opts...)
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
resp := &computepb.Operation{}
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
if settings.Path != "" {
baseUrl.Path = settings.Path
}
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
if err != nil {
return err
}
httpReq = httpReq.WithContext(ctx)
httpReq.Header = headers
httpRsp, err := c.httpClient.Do(httpReq)
if err != nil {
return err
}
defer httpRsp.Body.Close()
if err = googleapi.CheckResponse(httpRsp); err != nil {
return err
}
buf, err := ioutil.ReadAll(httpRsp.Body)
if err != nil {
return err
}
if err := unm.Unmarshal(buf, resp); err != nil {
return maybeUnknownEnum(err)
}
return nil
}, opts...)
if e != nil {
return nil, e
}
op := &Operation{
&regionOperationsHandle{
c: c.operationClient,
proto: resp,
project: req.GetProject(),
region: req.GetRegion(),
},
}
return op, nil
}
// VpnTunnelIterator manages a stream of *computepb.VpnTunnel.
type VpnTunnelIterator struct {
items []*computepb.VpnTunnel

View file

@ -96,7 +96,8 @@ func (c *ZoneOperationsClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *ZoneOperationsClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -185,7 +186,7 @@ func (c *zoneOperationsRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *zoneOperationsRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -90,7 +90,8 @@ func (c *ZonesClient) setGoogleClientInfo(keyval ...string) {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: Connections are now pooled so this method does not always
// return the same resource.
func (c *ZonesClient) Connection() *grpc.ClientConn {
return c.internalClient.Connection()
}
@ -169,7 +170,7 @@ func (c *zonesRESTClient) Close() error {
// Connection returns a connection to the API service.
//
// Deprecated.
// Deprecated: This method always returns nil.
func (c *zonesRESTClient) Connection() *grpc.ClientConn {
return nil
}

View file

@ -15,4 +15,4 @@
package internal
// Version is the current tagged release of the library.
const Version = "1.9.0"
const Version = "1.10.0"

View file

@ -178,5 +178,5 @@ func Verify(token string, key *rsa.PublicKey) error {
h := sha256.New()
h.Write([]byte(signedContent))
return rsa.VerifyPKCS1v15(key, crypto.SHA256, h.Sum(nil), []byte(signatureString))
return rsa.VerifyPKCS1v15(key, crypto.SHA256, h.Sum(nil), signatureString)
}

File diff suppressed because it is too large Load diff

6
vendor/modules.txt vendored
View file

@ -9,7 +9,7 @@ cloud.google.com/go/longrunning/autogen
# cloud.google.com/go/cloudbuild v1.2.0
## explicit
cloud.google.com/go/cloudbuild/apiv1
# cloud.google.com/go/compute v1.9.0
# cloud.google.com/go/compute v1.10.0
## explicit
cloud.google.com/go/compute/apiv1
cloud.google.com/go/compute/internal
@ -667,7 +667,7 @@ golang.org/x/net/internal/socks
golang.org/x/net/internal/timeseries
golang.org/x/net/proxy
golang.org/x/net/trace
# golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094
# golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1
## explicit
golang.org/x/oauth2
golang.org/x/oauth2/authhandler
@ -753,7 +753,7 @@ google.golang.org/appengine/internal/socket
google.golang.org/appengine/internal/urlfetch
google.golang.org/appengine/socket
google.golang.org/appengine/urlfetch
# google.golang.org/genproto v0.0.0-20220810155839-1856144b1d9c
# google.golang.org/genproto v0.0.0-20220915135415-7fd63a7952de
## explicit
google.golang.org/genproto/googleapis/api/annotations
google.golang.org/genproto/googleapis/api/httpbody