diff --git a/compute/apiv1/accelerator_types_client.go b/compute/apiv1/accelerator_types_client.go index ebb96df0ed2..419665c9325 100644 --- a/compute/apiv1/accelerator_types_client.go +++ b/compute/apiv1/accelerator_types_client.go @@ -17,7 +17,6 @@ package compute import ( - "bytes" "context" "fmt" "io/ioutil" @@ -139,8 +138,8 @@ func NewAcceleratorTypesRESTClient(ctx context.Context, opts ...option.ClientOpt func defaultAcceleratorTypesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -172,12 +171,6 @@ func (c *acceleratorTypesRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of accelerator types. func (c *acceleratorTypesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListAcceleratorTypesRequest, opts ...gax.CallOption) (*computepb.AcceleratorTypeAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/acceleratorTypes", req.GetProject()) @@ -203,7 +196,7 @@ func (c *acceleratorTypesRESTClient) AggregatedList(ctx context.Context, req *co baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -237,16 +230,10 @@ func (c *acceleratorTypesRESTClient) AggregatedList(ctx context.Context, req *co // Get returns the specified accelerator type. func (c *acceleratorTypesRESTClient) Get(ctx context.Context, req *computepb.GetAcceleratorTypeRequest, opts ...gax.CallOption) (*computepb.AcceleratorType, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/acceleratorTypes/%v", req.GetProject(), req.GetZone(), req.GetAcceleratorType()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -280,12 +267,6 @@ func (c *acceleratorTypesRESTClient) Get(ctx context.Context, req *computepb.Get // List retrieves a list of accelerator types that are available to the specified project. func (c *acceleratorTypesRESTClient) List(ctx context.Context, req *computepb.ListAcceleratorTypesRequest, opts ...gax.CallOption) (*computepb.AcceleratorTypeList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/acceleratorTypes", req.GetProject(), req.GetZone()) @@ -308,7 +289,7 @@ func (c *acceleratorTypesRESTClient) List(ctx context.Context, req *computepb.Li baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/addresses_client.go b/compute/apiv1/addresses_client.go index 023436436bd..dee8551455f 100644 --- a/compute/apiv1/addresses_client.go +++ b/compute/apiv1/addresses_client.go @@ -149,8 +149,8 @@ func NewAddressesRESTClient(ctx context.Context, opts ...option.ClientOption) (* func defaultAddressesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -182,12 +182,6 @@ func (c *addressesRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of addresses. func (c *addressesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListAddressesRequest, opts ...gax.CallOption) (*computepb.AddressAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/addresses", req.GetProject()) @@ -213,7 +207,7 @@ func (c *addressesRESTClient) AggregatedList(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -247,12 +241,6 @@ func (c *addressesRESTClient) AggregatedList(ctx context.Context, req *computepb // Delete deletes the specified address resource. func (c *addressesRESTClient) Delete(ctx context.Context, req *computepb.DeleteAddressRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/addresses/%v", req.GetProject(), req.GetRegion(), req.GetAddress()) @@ -263,7 +251,7 @@ func (c *addressesRESTClient) Delete(ctx context.Context, req *computepb.DeleteA baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -297,16 +285,10 @@ func (c *addressesRESTClient) Delete(ctx context.Context, req *computepb.DeleteA // Get returns the specified address resource. func (c *addressesRESTClient) Get(ctx context.Context, req *computepb.GetAddressRequest, opts ...gax.CallOption) (*computepb.Address, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/addresses/%v", req.GetProject(), req.GetRegion(), req.GetAddress()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -391,12 +373,6 @@ func (c *addressesRESTClient) Insert(ctx context.Context, req *computepb.InsertA // List retrieves a list of addresses contained within the specified region. func (c *addressesRESTClient) List(ctx context.Context, req *computepb.ListAddressesRequest, opts ...gax.CallOption) (*computepb.AddressList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/addresses", req.GetProject(), req.GetRegion()) @@ -419,7 +395,7 @@ func (c *addressesRESTClient) List(ctx context.Context, req *computepb.ListAddre baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/autoscalers_client.go b/compute/apiv1/autoscalers_client.go index 771438a9284..393a79fe905 100644 --- a/compute/apiv1/autoscalers_client.go +++ b/compute/apiv1/autoscalers_client.go @@ -163,8 +163,8 @@ func NewAutoscalersRESTClient(ctx context.Context, opts ...option.ClientOption) func defaultAutoscalersRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -196,12 +196,6 @@ func (c *autoscalersRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of autoscalers. func (c *autoscalersRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListAutoscalersRequest, opts ...gax.CallOption) (*computepb.AutoscalerAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/autoscalers", req.GetProject()) @@ -227,7 +221,7 @@ func (c *autoscalersRESTClient) AggregatedList(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -261,12 +255,6 @@ func (c *autoscalersRESTClient) AggregatedList(ctx context.Context, req *compute // Delete deletes the specified autoscaler. func (c *autoscalersRESTClient) Delete(ctx context.Context, req *computepb.DeleteAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/autoscalers/%v", req.GetProject(), req.GetZone(), req.GetAutoscaler()) @@ -277,7 +265,7 @@ func (c *autoscalersRESTClient) Delete(ctx context.Context, req *computepb.Delet baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -311,16 +299,10 @@ func (c *autoscalersRESTClient) Delete(ctx context.Context, req *computepb.Delet // Get returns the specified autoscaler resource. Gets a list of available autoscalers by making a list() request. func (c *autoscalersRESTClient) Get(ctx context.Context, req *computepb.GetAutoscalerRequest, opts ...gax.CallOption) (*computepb.Autoscaler, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/autoscalers/%v", req.GetProject(), req.GetZone(), req.GetAutoscaler()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -405,12 +387,6 @@ func (c *autoscalersRESTClient) Insert(ctx context.Context, req *computepb.Inser // List retrieves a list of autoscalers contained within the specified zone. func (c *autoscalersRESTClient) List(ctx context.Context, req *computepb.ListAutoscalersRequest, opts ...gax.CallOption) (*computepb.AutoscalerList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/autoscalers", req.GetProject(), req.GetZone()) @@ -433,7 +409,7 @@ func (c *autoscalersRESTClient) List(ctx context.Context, req *computepb.ListAut baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/backend_buckets_client.go b/compute/apiv1/backend_buckets_client.go index 89286c9d461..3e24c920372 100644 --- a/compute/apiv1/backend_buckets_client.go +++ b/compute/apiv1/backend_buckets_client.go @@ -170,8 +170,8 @@ func NewBackendBucketsRESTClient(ctx context.Context, opts ...option.ClientOptio func defaultBackendBucketsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -254,12 +254,6 @@ func (c *backendBucketsRESTClient) AddSignedUrlKey(ctx context.Context, req *com // Delete deletes the specified BackendBucket resource. func (c *backendBucketsRESTClient) Delete(ctx context.Context, req *computepb.DeleteBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendBuckets/%v", req.GetProject(), req.GetBackendBucket()) @@ -270,7 +264,7 @@ func (c *backendBucketsRESTClient) Delete(ctx context.Context, req *computepb.De baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -304,12 +298,6 @@ func (c *backendBucketsRESTClient) Delete(ctx context.Context, req *computepb.De // DeleteSignedUrlKey deletes a key for validating requests with signed URLs for this backend bucket. func (c *backendBucketsRESTClient) DeleteSignedUrlKey(ctx context.Context, req *computepb.DeleteSignedUrlKeyBackendBucketRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendBuckets/%v/deleteSignedUrlKey", req.GetProject(), req.GetBackendBucket()) @@ -323,7 +311,7 @@ func (c *backendBucketsRESTClient) DeleteSignedUrlKey(ctx context.Context, req * baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -357,16 +345,10 @@ func (c *backendBucketsRESTClient) DeleteSignedUrlKey(ctx context.Context, req * // Get returns the specified BackendBucket resource. Gets a list of available backend buckets by making a list() request. func (c *backendBucketsRESTClient) Get(ctx context.Context, req *computepb.GetBackendBucketRequest, opts ...gax.CallOption) (*computepb.BackendBucket, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendBuckets/%v", req.GetProject(), req.GetBackendBucket()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -451,12 +433,6 @@ func (c *backendBucketsRESTClient) Insert(ctx context.Context, req *computepb.In // List retrieves the list of BackendBucket resources available to the specified project. func (c *backendBucketsRESTClient) List(ctx context.Context, req *computepb.ListBackendBucketsRequest, opts ...gax.CallOption) (*computepb.BackendBucketList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendBuckets", req.GetProject()) @@ -479,7 +455,7 @@ func (c *backendBucketsRESTClient) List(ctx context.Context, req *computepb.List baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/backend_services_client.go b/compute/apiv1/backend_services_client.go index b6dc5e585b4..6dfc04caf21 100644 --- a/compute/apiv1/backend_services_client.go +++ b/compute/apiv1/backend_services_client.go @@ -195,8 +195,8 @@ func NewBackendServicesRESTClient(ctx context.Context, opts ...option.ClientOpti func defaultBackendServicesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -279,12 +279,6 @@ func (c *backendServicesRESTClient) AddSignedUrlKey(ctx context.Context, req *co // AggregatedList retrieves the list of all BackendService resources, regional and global, available to the specified project. func (c *backendServicesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListBackendServicesRequest, opts ...gax.CallOption) (*computepb.BackendServiceAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/backendServices", req.GetProject()) @@ -310,7 +304,7 @@ func (c *backendServicesRESTClient) AggregatedList(ctx context.Context, req *com baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -344,12 +338,6 @@ func (c *backendServicesRESTClient) AggregatedList(ctx context.Context, req *com // Delete deletes the specified BackendService resource. func (c *backendServicesRESTClient) Delete(ctx context.Context, req *computepb.DeleteBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices/%v", req.GetProject(), req.GetBackendService()) @@ -360,7 +348,7 @@ func (c *backendServicesRESTClient) Delete(ctx context.Context, req *computepb.D baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -394,12 +382,6 @@ func (c *backendServicesRESTClient) Delete(ctx context.Context, req *computepb.D // DeleteSignedUrlKey deletes a key for validating requests with signed URLs for this backend service. func (c *backendServicesRESTClient) DeleteSignedUrlKey(ctx context.Context, req *computepb.DeleteSignedUrlKeyBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices/%v/deleteSignedUrlKey", req.GetProject(), req.GetBackendService()) @@ -413,7 +395,7 @@ func (c *backendServicesRESTClient) DeleteSignedUrlKey(ctx context.Context, req baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -447,16 +429,10 @@ func (c *backendServicesRESTClient) DeleteSignedUrlKey(ctx context.Context, req // Get returns the specified BackendService resource. Gets a list of available backend services. func (c *backendServicesRESTClient) Get(ctx context.Context, req *computepb.GetBackendServiceRequest, opts ...gax.CallOption) (*computepb.BackendService, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices/%v", req.GetProject(), req.GetBackendService()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -589,12 +565,6 @@ func (c *backendServicesRESTClient) Insert(ctx context.Context, req *computepb.I // List retrieves the list of BackendService resources available to the specified project. func (c *backendServicesRESTClient) List(ctx context.Context, req *computepb.ListBackendServicesRequest, opts ...gax.CallOption) (*computepb.BackendServiceList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/backendServices", req.GetProject()) @@ -617,7 +587,7 @@ func (c *backendServicesRESTClient) List(ctx context.Context, req *computepb.Lis baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/disk_types_client.go b/compute/apiv1/disk_types_client.go index aeb5487e614..596153747be 100644 --- a/compute/apiv1/disk_types_client.go +++ b/compute/apiv1/disk_types_client.go @@ -17,7 +17,6 @@ package compute import ( - "bytes" "context" "fmt" "io/ioutil" @@ -135,8 +134,8 @@ func NewDiskTypesRESTClient(ctx context.Context, opts ...option.ClientOption) (* func defaultDiskTypesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -168,12 +167,6 @@ func (c *diskTypesRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of disk types. func (c *diskTypesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListDiskTypesRequest, opts ...gax.CallOption) (*computepb.DiskTypeAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/diskTypes", req.GetProject()) @@ -199,7 +192,7 @@ func (c *diskTypesRESTClient) AggregatedList(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -233,16 +226,10 @@ func (c *diskTypesRESTClient) AggregatedList(ctx context.Context, req *computepb // Get returns the specified disk type. Gets a list of available disk types by making a list() request. func (c *diskTypesRESTClient) Get(ctx context.Context, req *computepb.GetDiskTypeRequest, opts ...gax.CallOption) (*computepb.DiskType, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/diskTypes/%v", req.GetProject(), req.GetZone(), req.GetDiskType()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -276,12 +263,6 @@ func (c *diskTypesRESTClient) Get(ctx context.Context, req *computepb.GetDiskTyp // List retrieves a list of disk types available to the specified project. func (c *diskTypesRESTClient) List(ctx context.Context, req *computepb.ListDiskTypesRequest, opts ...gax.CallOption) (*computepb.DiskTypeList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/diskTypes", req.GetProject(), req.GetZone()) @@ -304,7 +285,7 @@ func (c *diskTypesRESTClient) List(ctx context.Context, req *computepb.ListDiskT baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/disks_client.go b/compute/apiv1/disks_client.go index 60e3f5e44dc..37dea8eaf61 100644 --- a/compute/apiv1/disks_client.go +++ b/compute/apiv1/disks_client.go @@ -205,8 +205,8 @@ func NewDisksRESTClient(ctx context.Context, opts ...option.ClientOption) (*Disk func defaultDisksRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -289,12 +289,6 @@ func (c *disksRESTClient) AddResourcePolicies(ctx context.Context, req *computep // AggregatedList retrieves an aggregated list of persistent disks. func (c *disksRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListDisksRequest, opts ...gax.CallOption) (*computepb.DiskAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/disks", req.GetProject()) @@ -320,7 +314,7 @@ func (c *disksRESTClient) AggregatedList(ctx context.Context, req *computepb.Agg baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -408,12 +402,6 @@ func (c *disksRESTClient) CreateSnapshot(ctx context.Context, req *computepb.Cre // Delete deletes the specified persistent disk. Deleting a disk removes its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots. func (c *disksRESTClient) Delete(ctx context.Context, req *computepb.DeleteDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v", req.GetProject(), req.GetZone(), req.GetDisk()) @@ -424,7 +412,7 @@ func (c *disksRESTClient) Delete(ctx context.Context, req *computepb.DeleteDiskR baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -458,16 +446,10 @@ func (c *disksRESTClient) Delete(ctx context.Context, req *computepb.DeleteDiskR // Get returns a specified persistent disk. Gets a list of available persistent disks by making a list() request. func (c *disksRESTClient) Get(ctx context.Context, req *computepb.GetDiskRequest, opts ...gax.CallOption) (*computepb.Disk, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v", req.GetProject(), req.GetZone(), req.GetDisk()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -501,12 +483,6 @@ func (c *disksRESTClient) Get(ctx context.Context, req *computepb.GetDiskRequest // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. func (c *disksRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyDiskRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v/getIamPolicy", req.GetProject(), req.GetZone(), req.GetResource()) @@ -517,7 +493,7 @@ func (c *disksRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIa baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -605,12 +581,6 @@ func (c *disksRESTClient) Insert(ctx context.Context, req *computepb.InsertDiskR // List retrieves a list of persistent disks contained within the specified zone. func (c *disksRESTClient) List(ctx context.Context, req *computepb.ListDisksRequest, opts ...gax.CallOption) (*computepb.DiskList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks", req.GetProject(), req.GetZone()) @@ -633,7 +603,7 @@ func (c *disksRESTClient) List(ctx context.Context, req *computepb.ListDisksRequ baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/doc.go b/compute/apiv1/doc.go index 8758f29ac30..fab61754dbf 100644 --- a/compute/apiv1/doc.go +++ b/compute/apiv1/doc.go @@ -48,7 +48,7 @@ import ( type clientHookParams struct{} type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) -const versionClient = "20210702" +const versionClient = "20210707" func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { out, _ := metadata.FromOutgoingContext(ctx) diff --git a/compute/apiv1/external_vpn_gateways_client.go b/compute/apiv1/external_vpn_gateways_client.go index 00311af9054..fc1a32cebe6 100644 --- a/compute/apiv1/external_vpn_gateways_client.go +++ b/compute/apiv1/external_vpn_gateways_client.go @@ -156,8 +156,8 @@ func NewExternalVpnGatewaysRESTClient(ctx context.Context, opts ...option.Client func defaultExternalVpnGatewaysRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -189,12 +189,6 @@ func (c *externalVpnGatewaysRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified externalVpnGateway. func (c *externalVpnGatewaysRESTClient) Delete(ctx context.Context, req *computepb.DeleteExternalVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/externalVpnGateways/%v", req.GetProject(), req.GetExternalVpnGateway()) @@ -205,7 +199,7 @@ func (c *externalVpnGatewaysRESTClient) Delete(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -239,16 +233,10 @@ func (c *externalVpnGatewaysRESTClient) Delete(ctx context.Context, req *compute // Get returns the specified externalVpnGateway. Get a list of available externalVpnGateways by making a list() request. func (c *externalVpnGatewaysRESTClient) Get(ctx context.Context, req *computepb.GetExternalVpnGatewayRequest, opts ...gax.CallOption) (*computepb.ExternalVpnGateway, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/externalVpnGateways/%v", req.GetProject(), req.GetExternalVpnGateway()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -333,12 +321,6 @@ func (c *externalVpnGatewaysRESTClient) Insert(ctx context.Context, req *compute // List retrieves the list of ExternalVpnGateway available to the specified project. func (c *externalVpnGatewaysRESTClient) List(ctx context.Context, req *computepb.ListExternalVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.ExternalVpnGatewayList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/externalVpnGateways", req.GetProject()) @@ -361,7 +343,7 @@ func (c *externalVpnGatewaysRESTClient) List(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/firewall_policies_client.go b/compute/apiv1/firewall_policies_client.go index 4b224a975c3..628cbd02c9d 100644 --- a/compute/apiv1/firewall_policies_client.go +++ b/compute/apiv1/firewall_policies_client.go @@ -240,8 +240,8 @@ func NewFirewallPoliciesRESTClient(ctx context.Context, opts ...option.ClientOpt func defaultFirewallPoliciesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -378,12 +378,6 @@ func (c *firewallPoliciesRESTClient) AddRule(ctx context.Context, req *computepb // CloneRules copies rules to the specified firewall policy. func (c *firewallPoliciesRESTClient) CloneRules(ctx context.Context, req *computepb.CloneRulesFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/cloneRules", req.GetFirewallPolicy()) @@ -397,7 +391,7 @@ func (c *firewallPoliciesRESTClient) CloneRules(ctx context.Context, req *comput baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -431,12 +425,6 @@ func (c *firewallPoliciesRESTClient) CloneRules(ctx context.Context, req *comput // Delete deletes the specified policy. func (c *firewallPoliciesRESTClient) Delete(ctx context.Context, req *computepb.DeleteFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v", req.GetFirewallPolicy()) @@ -447,7 +435,7 @@ func (c *firewallPoliciesRESTClient) Delete(ctx context.Context, req *computepb. baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -481,16 +469,10 @@ func (c *firewallPoliciesRESTClient) Delete(ctx context.Context, req *computepb. // Get returns the specified firewall policy. func (c *firewallPoliciesRESTClient) Get(ctx context.Context, req *computepb.GetFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.FirewallPolicy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v", req.GetFirewallPolicy()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -524,12 +506,6 @@ func (c *firewallPoliciesRESTClient) Get(ctx context.Context, req *computepb.Get // GetAssociation gets an association with the specified name. func (c *firewallPoliciesRESTClient) GetAssociation(ctx context.Context, req *computepb.GetAssociationFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.FirewallPolicyAssociation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/getAssociation", req.GetFirewallPolicy()) @@ -540,7 +516,7 @@ func (c *firewallPoliciesRESTClient) GetAssociation(ctx context.Context, req *co baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -574,12 +550,6 @@ func (c *firewallPoliciesRESTClient) GetAssociation(ctx context.Context, req *co // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. func (c *firewallPoliciesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/getIamPolicy", req.GetResource()) @@ -590,7 +560,7 @@ func (c *firewallPoliciesRESTClient) GetIamPolicy(ctx context.Context, req *comp baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -624,12 +594,6 @@ func (c *firewallPoliciesRESTClient) GetIamPolicy(ctx context.Context, req *comp // GetRule gets a rule of the specified priority. func (c *firewallPoliciesRESTClient) GetRule(ctx context.Context, req *computepb.GetRuleFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.FirewallPolicyRule, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/getRule", req.GetFirewallPolicy()) @@ -640,7 +604,7 @@ func (c *firewallPoliciesRESTClient) GetRule(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -728,12 +692,6 @@ func (c *firewallPoliciesRESTClient) Insert(ctx context.Context, req *computepb. // List lists all the policies that have been configured for the specified project. func (c *firewallPoliciesRESTClient) List(ctx context.Context, req *computepb.ListFirewallPoliciesRequest, opts ...gax.CallOption) (*computepb.FirewallPolicyList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies") @@ -759,7 +717,7 @@ func (c *firewallPoliciesRESTClient) List(ctx context.Context, req *computepb.Li baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -793,12 +751,6 @@ func (c *firewallPoliciesRESTClient) List(ctx context.Context, req *computepb.Li // ListAssociations lists associations of a specified target, i.e., organization or folder. func (c *firewallPoliciesRESTClient) ListAssociations(ctx context.Context, req *computepb.ListAssociationsFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.FirewallPoliciesListAssociationsResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/listAssociations") @@ -809,7 +761,7 @@ func (c *firewallPoliciesRESTClient) ListAssociations(ctx context.Context, req * baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -843,12 +795,6 @@ func (c *firewallPoliciesRESTClient) ListAssociations(ctx context.Context, req * // Move moves the specified firewall policy. func (c *firewallPoliciesRESTClient) Move(ctx context.Context, req *computepb.MoveFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/move", req.GetFirewallPolicy()) @@ -862,7 +808,7 @@ func (c *firewallPoliciesRESTClient) Move(ctx context.Context, req *computepb.Mo baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1001,12 +947,6 @@ func (c *firewallPoliciesRESTClient) PatchRule(ctx context.Context, req *compute // RemoveAssociation removes an association for the specified firewall policy. func (c *firewallPoliciesRESTClient) RemoveAssociation(ctx context.Context, req *computepb.RemoveAssociationFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/removeAssociation", req.GetFirewallPolicy()) @@ -1020,7 +960,7 @@ func (c *firewallPoliciesRESTClient) RemoveAssociation(ctx context.Context, req baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1054,12 +994,6 @@ func (c *firewallPoliciesRESTClient) RemoveAssociation(ctx context.Context, req // RemoveRule deletes a rule of the specified priority. func (c *firewallPoliciesRESTClient) RemoveRule(ctx context.Context, req *computepb.RemoveRuleFirewallPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/firewallPolicies/%v/removeRule", req.GetFirewallPolicy()) @@ -1073,7 +1007,7 @@ func (c *firewallPoliciesRESTClient) RemoveRule(ctx context.Context, req *comput baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/firewalls_client.go b/compute/apiv1/firewalls_client.go index 2d764796b19..ab79288e262 100644 --- a/compute/apiv1/firewalls_client.go +++ b/compute/apiv1/firewalls_client.go @@ -156,8 +156,8 @@ func NewFirewallsRESTClient(ctx context.Context, opts ...option.ClientOption) (* func defaultFirewallsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -189,12 +189,6 @@ func (c *firewallsRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified firewall. func (c *firewallsRESTClient) Delete(ctx context.Context, req *computepb.DeleteFirewallRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/firewalls/%v", req.GetProject(), req.GetFirewall()) @@ -205,7 +199,7 @@ func (c *firewallsRESTClient) Delete(ctx context.Context, req *computepb.DeleteF baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -239,16 +233,10 @@ func (c *firewallsRESTClient) Delete(ctx context.Context, req *computepb.DeleteF // Get returns the specified firewall. func (c *firewallsRESTClient) Get(ctx context.Context, req *computepb.GetFirewallRequest, opts ...gax.CallOption) (*computepb.Firewall, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/firewalls/%v", req.GetProject(), req.GetFirewall()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -333,12 +321,6 @@ func (c *firewallsRESTClient) Insert(ctx context.Context, req *computepb.InsertF // List retrieves the list of firewall rules available to the specified project. func (c *firewallsRESTClient) List(ctx context.Context, req *computepb.ListFirewallsRequest, opts ...gax.CallOption) (*computepb.FirewallList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/firewalls", req.GetProject()) @@ -361,7 +343,7 @@ func (c *firewallsRESTClient) List(ctx context.Context, req *computepb.ListFirew baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/forwarding_rules_client.go b/compute/apiv1/forwarding_rules_client.go index de0011546a5..521af0b353f 100644 --- a/compute/apiv1/forwarding_rules_client.go +++ b/compute/apiv1/forwarding_rules_client.go @@ -170,8 +170,8 @@ func NewForwardingRulesRESTClient(ctx context.Context, opts ...option.ClientOpti func defaultForwardingRulesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -203,12 +203,6 @@ func (c *forwardingRulesRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of forwarding rules. func (c *forwardingRulesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListForwardingRulesRequest, opts ...gax.CallOption) (*computepb.ForwardingRuleAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/forwardingRules", req.GetProject()) @@ -234,7 +228,7 @@ func (c *forwardingRulesRESTClient) AggregatedList(ctx context.Context, req *com baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -268,12 +262,6 @@ func (c *forwardingRulesRESTClient) AggregatedList(ctx context.Context, req *com // Delete deletes the specified ForwardingRule resource. func (c *forwardingRulesRESTClient) Delete(ctx context.Context, req *computepb.DeleteForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/forwardingRules/%v", req.GetProject(), req.GetRegion(), req.GetForwardingRule()) @@ -284,7 +272,7 @@ func (c *forwardingRulesRESTClient) Delete(ctx context.Context, req *computepb.D baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -318,16 +306,10 @@ func (c *forwardingRulesRESTClient) Delete(ctx context.Context, req *computepb.D // Get returns the specified ForwardingRule resource. func (c *forwardingRulesRESTClient) Get(ctx context.Context, req *computepb.GetForwardingRuleRequest, opts ...gax.CallOption) (*computepb.ForwardingRule, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/forwardingRules/%v", req.GetProject(), req.GetRegion(), req.GetForwardingRule()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -412,12 +394,6 @@ func (c *forwardingRulesRESTClient) Insert(ctx context.Context, req *computepb.I // List retrieves a list of ForwardingRule resources available to the specified project and region. func (c *forwardingRulesRESTClient) List(ctx context.Context, req *computepb.ListForwardingRulesRequest, opts ...gax.CallOption) (*computepb.ForwardingRuleList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/forwardingRules", req.GetProject(), req.GetRegion()) @@ -440,7 +416,7 @@ func (c *forwardingRulesRESTClient) List(ctx context.Context, req *computepb.Lis baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/global_addresses_client.go b/compute/apiv1/global_addresses_client.go index cc877465301..f7814d32923 100644 --- a/compute/apiv1/global_addresses_client.go +++ b/compute/apiv1/global_addresses_client.go @@ -142,8 +142,8 @@ func NewGlobalAddressesRESTClient(ctx context.Context, opts ...option.ClientOpti func defaultGlobalAddressesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -175,12 +175,6 @@ func (c *globalAddressesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified address resource. func (c *globalAddressesRESTClient) Delete(ctx context.Context, req *computepb.DeleteGlobalAddressRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/addresses/%v", req.GetProject(), req.GetAddress()) @@ -191,7 +185,7 @@ func (c *globalAddressesRESTClient) Delete(ctx context.Context, req *computepb.D baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -225,16 +219,10 @@ func (c *globalAddressesRESTClient) Delete(ctx context.Context, req *computepb.D // Get returns the specified address resource. Gets a list of available addresses by making a list() request. func (c *globalAddressesRESTClient) Get(ctx context.Context, req *computepb.GetGlobalAddressRequest, opts ...gax.CallOption) (*computepb.Address, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/addresses/%v", req.GetProject(), req.GetAddress()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -319,12 +307,6 @@ func (c *globalAddressesRESTClient) Insert(ctx context.Context, req *computepb.I // List retrieves a list of global addresses. func (c *globalAddressesRESTClient) List(ctx context.Context, req *computepb.ListGlobalAddressesRequest, opts ...gax.CallOption) (*computepb.AddressList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/addresses", req.GetProject()) @@ -347,7 +329,7 @@ func (c *globalAddressesRESTClient) List(ctx context.Context, req *computepb.Lis baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/global_forwarding_rules_client.go b/compute/apiv1/global_forwarding_rules_client.go index 31126501041..124a27fe619 100644 --- a/compute/apiv1/global_forwarding_rules_client.go +++ b/compute/apiv1/global_forwarding_rules_client.go @@ -163,8 +163,8 @@ func NewGlobalForwardingRulesRESTClient(ctx context.Context, opts ...option.Clie func defaultGlobalForwardingRulesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -196,12 +196,6 @@ func (c *globalForwardingRulesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified GlobalForwardingRule resource. func (c *globalForwardingRulesRESTClient) Delete(ctx context.Context, req *computepb.DeleteGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/forwardingRules/%v", req.GetProject(), req.GetForwardingRule()) @@ -212,7 +206,7 @@ func (c *globalForwardingRulesRESTClient) Delete(ctx context.Context, req *compu baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -246,16 +240,10 @@ func (c *globalForwardingRulesRESTClient) Delete(ctx context.Context, req *compu // Get returns the specified GlobalForwardingRule resource. Gets a list of available forwarding rules by making a list() request. func (c *globalForwardingRulesRESTClient) Get(ctx context.Context, req *computepb.GetGlobalForwardingRuleRequest, opts ...gax.CallOption) (*computepb.ForwardingRule, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/forwardingRules/%v", req.GetProject(), req.GetForwardingRule()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -340,12 +328,6 @@ func (c *globalForwardingRulesRESTClient) Insert(ctx context.Context, req *compu // List retrieves a list of GlobalForwardingRule resources available to the specified project. func (c *globalForwardingRulesRESTClient) List(ctx context.Context, req *computepb.ListGlobalForwardingRulesRequest, opts ...gax.CallOption) (*computepb.ForwardingRuleList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/forwardingRules", req.GetProject()) @@ -368,7 +350,7 @@ func (c *globalForwardingRulesRESTClient) List(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/global_network_endpoint_groups_client.go b/compute/apiv1/global_network_endpoint_groups_client.go index 54f22cccf5d..48ce9031cac 100644 --- a/compute/apiv1/global_network_endpoint_groups_client.go +++ b/compute/apiv1/global_network_endpoint_groups_client.go @@ -163,8 +163,8 @@ func NewGlobalNetworkEndpointGroupsRESTClient(ctx context.Context, opts ...optio func defaultGlobalNetworkEndpointGroupsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -247,12 +247,6 @@ func (c *globalNetworkEndpointGroupsRESTClient) AttachNetworkEndpoints(ctx conte // Delete deletes the specified network endpoint group.Note that the NEG cannot be deleted if there are backend services referencing it. func (c *globalNetworkEndpointGroupsRESTClient) Delete(ctx context.Context, req *computepb.DeleteGlobalNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networkEndpointGroups/%v", req.GetProject(), req.GetNetworkEndpointGroup()) @@ -263,7 +257,7 @@ func (c *globalNetworkEndpointGroupsRESTClient) Delete(ctx context.Context, req baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -348,16 +342,10 @@ func (c *globalNetworkEndpointGroupsRESTClient) DetachNetworkEndpoints(ctx conte // Get returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request. func (c *globalNetworkEndpointGroupsRESTClient) Get(ctx context.Context, req *computepb.GetGlobalNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroup, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networkEndpointGroups/%v", req.GetProject(), req.GetNetworkEndpointGroup()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -442,12 +430,6 @@ func (c *globalNetworkEndpointGroupsRESTClient) Insert(ctx context.Context, req // List retrieves the list of network endpoint groups that are located in the specified project. func (c *globalNetworkEndpointGroupsRESTClient) List(ctx context.Context, req *computepb.ListGlobalNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networkEndpointGroups", req.GetProject()) @@ -470,7 +452,7 @@ func (c *globalNetworkEndpointGroupsRESTClient) List(ctx context.Context, req *c baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -504,12 +486,6 @@ func (c *globalNetworkEndpointGroupsRESTClient) List(ctx context.Context, req *c // ListNetworkEndpoints lists the network endpoints in the specified network endpoint group. func (c *globalNetworkEndpointGroupsRESTClient) ListNetworkEndpoints(ctx context.Context, req *computepb.ListNetworkEndpointsGlobalNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupsListNetworkEndpoints, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networkEndpointGroups/%v/listNetworkEndpoints", req.GetProject(), req.GetNetworkEndpointGroup()) @@ -532,7 +508,7 @@ func (c *globalNetworkEndpointGroupsRESTClient) ListNetworkEndpoints(ctx context baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/global_operations_client.go b/compute/apiv1/global_operations_client.go index 928eedface2..9167c8c9d26 100644 --- a/compute/apiv1/global_operations_client.go +++ b/compute/apiv1/global_operations_client.go @@ -17,7 +17,6 @@ package compute import ( - "bytes" "context" "fmt" "io/ioutil" @@ -155,8 +154,8 @@ func NewGlobalOperationsRESTClient(ctx context.Context, opts ...option.ClientOpt func defaultGlobalOperationsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -188,12 +187,6 @@ func (c *globalOperationsRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of all operations. func (c *globalOperationsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListGlobalOperationsRequest, opts ...gax.CallOption) (*computepb.OperationAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/operations", req.GetProject()) @@ -219,7 +212,7 @@ func (c *globalOperationsRESTClient) AggregatedList(ctx context.Context, req *co baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -253,16 +246,10 @@ func (c *globalOperationsRESTClient) AggregatedList(ctx context.Context, req *co // Delete deletes the specified Operations resource. func (c *globalOperationsRESTClient) Delete(ctx context.Context, req *computepb.DeleteGlobalOperationRequest, opts ...gax.CallOption) (*computepb.DeleteGlobalOperationResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/operations/%v", req.GetProject(), req.GetOperation()) - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -296,16 +283,10 @@ func (c *globalOperationsRESTClient) Delete(ctx context.Context, req *computepb. // Get retrieves the specified Operations resource. Gets a list of operations by making a list() request. func (c *globalOperationsRESTClient) Get(ctx context.Context, req *computepb.GetGlobalOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/operations/%v", req.GetProject(), req.GetOperation()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -339,12 +320,6 @@ func (c *globalOperationsRESTClient) Get(ctx context.Context, req *computepb.Get // List retrieves a list of Operation resources contained within the specified project. func (c *globalOperationsRESTClient) List(ctx context.Context, req *computepb.ListGlobalOperationsRequest, opts ...gax.CallOption) (*computepb.OperationList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/operations", req.GetProject()) @@ -367,7 +342,7 @@ func (c *globalOperationsRESTClient) List(ctx context.Context, req *computepb.Li baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -407,16 +382,10 @@ func (c *globalOperationsRESTClient) List(ctx context.Context, req *computepb.Li // // If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not DONE. func (c *globalOperationsRESTClient) Wait(ctx context.Context, req *computepb.WaitGlobalOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/operations/%v/wait", req.GetProject(), req.GetOperation()) - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/global_organization_operations_client.go b/compute/apiv1/global_organization_operations_client.go index 94cec22cbfc..78565ecdd8d 100644 --- a/compute/apiv1/global_organization_operations_client.go +++ b/compute/apiv1/global_organization_operations_client.go @@ -17,7 +17,6 @@ package compute import ( - "bytes" "context" "fmt" "io/ioutil" @@ -135,8 +134,8 @@ func NewGlobalOrganizationOperationsRESTClient(ctx context.Context, opts ...opti func defaultGlobalOrganizationOperationsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -168,12 +167,6 @@ func (c *globalOrganizationOperationsRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified Operations resource. func (c *globalOrganizationOperationsRESTClient) Delete(ctx context.Context, req *computepb.DeleteGlobalOrganizationOperationRequest, opts ...gax.CallOption) (*computepb.DeleteGlobalOrganizationOperationResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/operations/%v", req.GetOperation()) @@ -184,7 +177,7 @@ func (c *globalOrganizationOperationsRESTClient) Delete(ctx context.Context, req baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -218,12 +211,6 @@ func (c *globalOrganizationOperationsRESTClient) Delete(ctx context.Context, req // Get retrieves the specified Operations resource. Gets a list of operations by making a list() request. func (c *globalOrganizationOperationsRESTClient) Get(ctx context.Context, req *computepb.GetGlobalOrganizationOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/operations/%v", req.GetOperation()) @@ -234,7 +221,7 @@ func (c *globalOrganizationOperationsRESTClient) Get(ctx context.Context, req *c baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -268,12 +255,6 @@ func (c *globalOrganizationOperationsRESTClient) Get(ctx context.Context, req *c // List retrieves a list of Operation resources contained within the specified organization. func (c *globalOrganizationOperationsRESTClient) List(ctx context.Context, req *computepb.ListGlobalOrganizationOperationsRequest, opts ...gax.CallOption) (*computepb.OperationList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/locations/global/operations") @@ -299,7 +280,7 @@ func (c *globalOrganizationOperationsRESTClient) List(ctx context.Context, req * baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/global_public_delegated_prefixes_client.go b/compute/apiv1/global_public_delegated_prefixes_client.go index b0e0fc7cc99..ed3af14a03e 100644 --- a/compute/apiv1/global_public_delegated_prefixes_client.go +++ b/compute/apiv1/global_public_delegated_prefixes_client.go @@ -149,8 +149,8 @@ func NewGlobalPublicDelegatedPrefixesRESTClient(ctx context.Context, opts ...opt func defaultGlobalPublicDelegatedPrefixesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -182,12 +182,6 @@ func (c *globalPublicDelegatedPrefixesRESTClient) Connection() *grpc.ClientConn // Delete deletes the specified global PublicDelegatedPrefix. func (c *globalPublicDelegatedPrefixesRESTClient) Delete(ctx context.Context, req *computepb.DeleteGlobalPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicDelegatedPrefixes/%v", req.GetProject(), req.GetPublicDelegatedPrefix()) @@ -198,7 +192,7 @@ func (c *globalPublicDelegatedPrefixesRESTClient) Delete(ctx context.Context, re baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -232,16 +226,10 @@ func (c *globalPublicDelegatedPrefixesRESTClient) Delete(ctx context.Context, re // Get returns the specified global PublicDelegatedPrefix resource. func (c *globalPublicDelegatedPrefixesRESTClient) Get(ctx context.Context, req *computepb.GetGlobalPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefix, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicDelegatedPrefixes/%v", req.GetProject(), req.GetPublicDelegatedPrefix()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -326,12 +314,6 @@ func (c *globalPublicDelegatedPrefixesRESTClient) Insert(ctx context.Context, re // List lists the global PublicDelegatedPrefixes for a project. func (c *globalPublicDelegatedPrefixesRESTClient) List(ctx context.Context, req *computepb.ListGlobalPublicDelegatedPrefixesRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefixList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicDelegatedPrefixes", req.GetProject()) @@ -354,7 +336,7 @@ func (c *globalPublicDelegatedPrefixesRESTClient) List(ctx context.Context, req baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/health_checks_client.go b/compute/apiv1/health_checks_client.go index 887b7c4a853..c4552d16768 100644 --- a/compute/apiv1/health_checks_client.go +++ b/compute/apiv1/health_checks_client.go @@ -163,8 +163,8 @@ func NewHealthChecksRESTClient(ctx context.Context, opts ...option.ClientOption) func defaultHealthChecksRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -196,12 +196,6 @@ func (c *healthChecksRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves the list of all HealthCheck resources, regional and global, available to the specified project. func (c *healthChecksRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListHealthChecksRequest, opts ...gax.CallOption) (*computepb.HealthChecksAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/healthChecks", req.GetProject()) @@ -227,7 +221,7 @@ func (c *healthChecksRESTClient) AggregatedList(ctx context.Context, req *comput baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -261,12 +255,6 @@ func (c *healthChecksRESTClient) AggregatedList(ctx context.Context, req *comput // Delete deletes the specified HealthCheck resource. func (c *healthChecksRESTClient) Delete(ctx context.Context, req *computepb.DeleteHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/healthChecks/%v", req.GetProject(), req.GetHealthCheck()) @@ -277,7 +265,7 @@ func (c *healthChecksRESTClient) Delete(ctx context.Context, req *computepb.Dele baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -311,16 +299,10 @@ func (c *healthChecksRESTClient) Delete(ctx context.Context, req *computepb.Dele // Get returns the specified HealthCheck resource. Gets a list of available health checks by making a list() request. func (c *healthChecksRESTClient) Get(ctx context.Context, req *computepb.GetHealthCheckRequest, opts ...gax.CallOption) (*computepb.HealthCheck, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/healthChecks/%v", req.GetProject(), req.GetHealthCheck()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -405,12 +387,6 @@ func (c *healthChecksRESTClient) Insert(ctx context.Context, req *computepb.Inse // List retrieves the list of HealthCheck resources available to the specified project. func (c *healthChecksRESTClient) List(ctx context.Context, req *computepb.ListHealthChecksRequest, opts ...gax.CallOption) (*computepb.HealthCheckList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/healthChecks", req.GetProject()) @@ -433,7 +409,7 @@ func (c *healthChecksRESTClient) List(ctx context.Context, req *computepb.ListHe baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/images_client.go b/compute/apiv1/images_client.go index 8fbfa02a672..5ca8bdf088a 100644 --- a/compute/apiv1/images_client.go +++ b/compute/apiv1/images_client.go @@ -193,8 +193,8 @@ func NewImagesRESTClient(ctx context.Context, opts ...option.ClientOption) (*Ima func defaultImagesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -226,12 +226,6 @@ func (c *imagesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified image. func (c *imagesRESTClient) Delete(ctx context.Context, req *computepb.DeleteImageRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/%v", req.GetProject(), req.GetImage()) @@ -242,7 +236,7 @@ func (c *imagesRESTClient) Delete(ctx context.Context, req *computepb.DeleteImag baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -329,16 +323,10 @@ func (c *imagesRESTClient) Deprecate(ctx context.Context, req *computepb.Depreca // Get returns the specified image. Gets a list of available images by making a list() request. func (c *imagesRESTClient) Get(ctx context.Context, req *computepb.GetImageRequest, opts ...gax.CallOption) (*computepb.Image, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/%v", req.GetProject(), req.GetImage()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -372,16 +360,10 @@ func (c *imagesRESTClient) Get(ctx context.Context, req *computepb.GetImageReque // GetFromFamily returns the latest image that is part of an image family and is not deprecated. func (c *imagesRESTClient) GetFromFamily(ctx context.Context, req *computepb.GetFromFamilyImageRequest, opts ...gax.CallOption) (*computepb.Image, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/family/%v", req.GetProject(), req.GetFamily()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -415,12 +397,6 @@ func (c *imagesRESTClient) GetFromFamily(ctx context.Context, req *computepb.Get // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. func (c *imagesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyImageRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images/%v/getIamPolicy", req.GetProject(), req.GetResource()) @@ -431,7 +407,7 @@ func (c *imagesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetI baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -519,12 +495,6 @@ func (c *imagesRESTClient) Insert(ctx context.Context, req *computepb.InsertImag // List retrieves the list of custom images available to the specified project. Custom images are images you create that belong to your project. This method does not get any images that belong to other projects, including publicly-available images, like Debian 8. If you want to get a list of publicly-available images, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud. func (c *imagesRESTClient) List(ctx context.Context, req *computepb.ListImagesRequest, opts ...gax.CallOption) (*computepb.ImageList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/images", req.GetProject()) @@ -547,7 +517,7 @@ func (c *imagesRESTClient) List(ctx context.Context, req *computepb.ListImagesRe baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/instance_group_managers_client.go b/compute/apiv1/instance_group_managers_client.go index 63039526088..71b5dae5f0c 100644 --- a/compute/apiv1/instance_group_managers_client.go +++ b/compute/apiv1/instance_group_managers_client.go @@ -276,8 +276,8 @@ func NewInstanceGroupManagersRESTClient(ctx context.Context, opts ...option.Clie func defaultInstanceGroupManagersRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -364,12 +364,6 @@ func (c *instanceGroupManagersRESTClient) AbandonInstances(ctx context.Context, // AggregatedList retrieves the list of managed instance groups and groups them by zone. func (c *instanceGroupManagersRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagerAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/instanceGroupManagers", req.GetProject()) @@ -395,7 +389,7 @@ func (c *instanceGroupManagersRESTClient) AggregatedList(ctx context.Context, re baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -524,12 +518,6 @@ func (c *instanceGroupManagersRESTClient) CreateInstances(ctx context.Context, r // Delete deletes the specified managed instance group and all of the instances in that group. Note that the instance group must not belong to a backend service. Read Deleting an instance group for more information. func (c *instanceGroupManagersRESTClient) Delete(ctx context.Context, req *computepb.DeleteInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) @@ -540,7 +528,7 @@ func (c *instanceGroupManagersRESTClient) Delete(ctx context.Context, req *compu baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -673,16 +661,10 @@ func (c *instanceGroupManagersRESTClient) DeletePerInstanceConfigs(ctx context.C // Get returns all of the details about the specified managed instance group. Gets a list of available managed instance groups by making a list() request. func (c *instanceGroupManagersRESTClient) Get(ctx context.Context, req *computepb.GetInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManager, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -769,12 +751,6 @@ func (c *instanceGroupManagersRESTClient) Insert(ctx context.Context, req *compu // List retrieves a list of managed instance groups that are contained within the specified project and zone. func (c *instanceGroupManagersRESTClient) List(ctx context.Context, req *computepb.ListInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagerList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers", req.GetProject(), req.GetZone()) @@ -797,7 +773,7 @@ func (c *instanceGroupManagersRESTClient) List(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -831,12 +807,6 @@ func (c *instanceGroupManagersRESTClient) List(ctx context.Context, req *compute // ListErrors lists all errors thrown by actions on instances for a given managed instance group. The filter and orderBy query parameters are not supported. func (c *instanceGroupManagersRESTClient) ListErrors(ctx context.Context, req *computepb.ListErrorsInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagersListErrorsResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/listErrors", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) @@ -859,7 +829,7 @@ func (c *instanceGroupManagersRESTClient) ListErrors(ctx context.Context, req *c baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -893,12 +863,6 @@ func (c *instanceGroupManagersRESTClient) ListErrors(ctx context.Context, req *c // ListManagedInstances lists all of the instances in the managed instance group. Each instance in the list has a currentAction, which indicates the action that the managed instance group is performing on the instance. For example, if the group is still creating an instance, the currentAction is CREATING. If a previous action failed, the list displays the errors for that failed action. The orderBy query parameter is not supported. func (c *instanceGroupManagersRESTClient) ListManagedInstances(ctx context.Context, req *computepb.ListManagedInstancesInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagersListManagedInstancesResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/listManagedInstances", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) @@ -921,7 +885,7 @@ func (c *instanceGroupManagersRESTClient) ListManagedInstances(ctx context.Conte baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -955,12 +919,6 @@ func (c *instanceGroupManagersRESTClient) ListManagedInstances(ctx context.Conte // ListPerInstanceConfigs lists all of the per-instance configs defined for the managed instance group. The orderBy query parameter is not supported. func (c *instanceGroupManagersRESTClient) ListPerInstanceConfigs(ctx context.Context, req *computepb.ListPerInstanceConfigsInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManagersListPerInstanceConfigsResp, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/listPerInstanceConfigs", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) @@ -983,7 +941,7 @@ func (c *instanceGroupManagersRESTClient) ListPerInstanceConfigs(ctx context.Con baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1182,12 +1140,6 @@ func (c *instanceGroupManagersRESTClient) RecreateInstances(ctx context.Context, // // If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. func (c *instanceGroupManagersRESTClient) Resize(ctx context.Context, req *computepb.ResizeInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroupManagers/%v/resize", req.GetProject(), req.GetZone(), req.GetInstanceGroupManager()) @@ -1201,7 +1153,7 @@ func (c *instanceGroupManagersRESTClient) Resize(ctx context.Context, req *compu baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/instance_groups_client.go b/compute/apiv1/instance_groups_client.go index 0d57cd32151..7c85f51c24a 100644 --- a/compute/apiv1/instance_groups_client.go +++ b/compute/apiv1/instance_groups_client.go @@ -183,8 +183,8 @@ func NewInstanceGroupsRESTClient(ctx context.Context, opts ...option.ClientOptio func defaultInstanceGroupsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -267,12 +267,6 @@ func (c *instanceGroupsRESTClient) AddInstances(ctx context.Context, req *comput // AggregatedList retrieves the list of instance groups and sorts them by zone. func (c *instanceGroupsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.InstanceGroupAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/instanceGroups", req.GetProject()) @@ -298,7 +292,7 @@ func (c *instanceGroupsRESTClient) AggregatedList(ctx context.Context, req *comp baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -332,12 +326,6 @@ func (c *instanceGroupsRESTClient) AggregatedList(ctx context.Context, req *comp // Delete deletes the specified instance group. The instances in the group are not deleted. Note that instance group must not belong to a backend service. Read Deleting an instance group for more information. func (c *instanceGroupsRESTClient) Delete(ctx context.Context, req *computepb.DeleteInstanceGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups/%v", req.GetProject(), req.GetZone(), req.GetInstanceGroup()) @@ -348,7 +336,7 @@ func (c *instanceGroupsRESTClient) Delete(ctx context.Context, req *computepb.De baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -384,16 +372,10 @@ func (c *instanceGroupsRESTClient) Delete(ctx context.Context, req *computepb.De // // For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead. func (c *instanceGroupsRESTClient) Get(ctx context.Context, req *computepb.GetInstanceGroupRequest, opts ...gax.CallOption) (*computepb.InstanceGroup, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups/%v", req.GetProject(), req.GetZone(), req.GetInstanceGroup()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -480,12 +462,6 @@ func (c *instanceGroupsRESTClient) Insert(ctx context.Context, req *computepb.In // // For managed instance groups, use the instanceGroupManagers or regionInstanceGroupManagers methods instead. func (c *instanceGroupsRESTClient) List(ctx context.Context, req *computepb.ListInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.InstanceGroupList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instanceGroups", req.GetProject(), req.GetZone()) @@ -508,7 +484,7 @@ func (c *instanceGroupsRESTClient) List(ctx context.Context, req *computepb.List baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/instance_templates_client.go b/compute/apiv1/instance_templates_client.go index 2003c355cf0..43f9239088f 100644 --- a/compute/apiv1/instance_templates_client.go +++ b/compute/apiv1/instance_templates_client.go @@ -163,8 +163,8 @@ func NewInstanceTemplatesRESTClient(ctx context.Context, opts ...option.ClientOp func defaultInstanceTemplatesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -196,12 +196,6 @@ func (c *instanceTemplatesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified instance template. Deleting an instance template is permanent and cannot be undone. It is not possible to delete templates that are already in use by a managed instance group. func (c *instanceTemplatesRESTClient) Delete(ctx context.Context, req *computepb.DeleteInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/instanceTemplates/%v", req.GetProject(), req.GetInstanceTemplate()) @@ -212,7 +206,7 @@ func (c *instanceTemplatesRESTClient) Delete(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -246,16 +240,10 @@ func (c *instanceTemplatesRESTClient) Delete(ctx context.Context, req *computepb // Get returns the specified instance template. Gets a list of available instance templates by making a list() request. func (c *instanceTemplatesRESTClient) Get(ctx context.Context, req *computepb.GetInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.InstanceTemplate, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/instanceTemplates/%v", req.GetProject(), req.GetInstanceTemplate()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -289,12 +277,6 @@ func (c *instanceTemplatesRESTClient) Get(ctx context.Context, req *computepb.Ge // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. func (c *instanceTemplatesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyInstanceTemplateRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/instanceTemplates/%v/getIamPolicy", req.GetProject(), req.GetResource()) @@ -305,7 +287,7 @@ func (c *instanceTemplatesRESTClient) GetIamPolicy(ctx context.Context, req *com baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -390,12 +372,6 @@ func (c *instanceTemplatesRESTClient) Insert(ctx context.Context, req *computepb // List retrieves a list of instance templates that are contained within the specified project. func (c *instanceTemplatesRESTClient) List(ctx context.Context, req *computepb.ListInstanceTemplatesRequest, opts ...gax.CallOption) (*computepb.InstanceTemplateList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/instanceTemplates", req.GetProject()) @@ -418,7 +394,7 @@ func (c *instanceTemplatesRESTClient) List(ctx context.Context, req *computepb.L baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/instances_client.go b/compute/apiv1/instances_client.go index 365b3efe4fc..e0adbc48622 100644 --- a/compute/apiv1/instances_client.go +++ b/compute/apiv1/instances_client.go @@ -408,8 +408,8 @@ func NewInstancesRESTClient(ctx context.Context, opts ...option.ClientOption) (* func defaultInstancesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -546,12 +546,6 @@ func (c *instancesRESTClient) AddResourcePolicies(ctx context.Context, req *comp // AggregatedList retrieves aggregated list of all of the instances in your project across all regions and zones. func (c *instancesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInstancesRequest, opts ...gax.CallOption) (*computepb.InstanceAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/instances", req.GetProject()) @@ -577,7 +571,7 @@ func (c *instancesRESTClient) AggregatedList(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -716,12 +710,6 @@ func (c *instancesRESTClient) BulkInsert(ctx context.Context, req *computepb.Bul // Delete deletes the specified Instance resource. For more information, see Deleting an instance. func (c *instancesRESTClient) Delete(ctx context.Context, req *computepb.DeleteInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v", req.GetProject(), req.GetZone(), req.GetInstance()) @@ -732,7 +720,7 @@ func (c *instancesRESTClient) Delete(ctx context.Context, req *computepb.DeleteI baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -766,12 +754,6 @@ func (c *instancesRESTClient) Delete(ctx context.Context, req *computepb.DeleteI // DeleteAccessConfig deletes an access config from an instance’s network interface. func (c *instancesRESTClient) DeleteAccessConfig(ctx context.Context, req *computepb.DeleteAccessConfigInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/deleteAccessConfig", req.GetProject(), req.GetZone(), req.GetInstance()) @@ -788,7 +770,7 @@ func (c *instancesRESTClient) DeleteAccessConfig(ctx context.Context, req *compu baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -822,12 +804,6 @@ func (c *instancesRESTClient) DeleteAccessConfig(ctx context.Context, req *compu // DetachDisk detaches a disk from an instance. func (c *instancesRESTClient) DetachDisk(ctx context.Context, req *computepb.DetachDiskInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/detachDisk", req.GetProject(), req.GetZone(), req.GetInstance()) @@ -841,7 +817,7 @@ func (c *instancesRESTClient) DetachDisk(ctx context.Context, req *computepb.Det baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -875,16 +851,10 @@ func (c *instancesRESTClient) DetachDisk(ctx context.Context, req *computepb.Det // Get returns the specified Instance resource. Gets a list of available instances by making a list() request. func (c *instancesRESTClient) Get(ctx context.Context, req *computepb.GetInstanceRequest, opts ...gax.CallOption) (*computepb.Instance, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v", req.GetProject(), req.GetZone(), req.GetInstance()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -918,12 +888,6 @@ func (c *instancesRESTClient) Get(ctx context.Context, req *computepb.GetInstanc // GetEffectiveFirewalls returns effective firewalls applied to an interface of the instance. func (c *instancesRESTClient) GetEffectiveFirewalls(ctx context.Context, req *computepb.GetEffectiveFirewallsInstanceRequest, opts ...gax.CallOption) (*computepb.InstancesGetEffectiveFirewallsResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/getEffectiveFirewalls", req.GetProject(), req.GetZone(), req.GetInstance()) @@ -934,7 +898,7 @@ func (c *instancesRESTClient) GetEffectiveFirewalls(ctx context.Context, req *co baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -968,12 +932,6 @@ func (c *instancesRESTClient) GetEffectiveFirewalls(ctx context.Context, req *co // GetGuestAttributes returns the specified guest attributes entry. func (c *instancesRESTClient) GetGuestAttributes(ctx context.Context, req *computepb.GetGuestAttributesInstanceRequest, opts ...gax.CallOption) (*computepb.GuestAttributes, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/getGuestAttributes", req.GetProject(), req.GetZone(), req.GetInstance()) @@ -987,7 +945,7 @@ func (c *instancesRESTClient) GetGuestAttributes(ctx context.Context, req *compu baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1021,12 +979,6 @@ func (c *instancesRESTClient) GetGuestAttributes(ctx context.Context, req *compu // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. func (c *instancesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyInstanceRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/getIamPolicy", req.GetProject(), req.GetZone(), req.GetResource()) @@ -1037,7 +989,7 @@ func (c *instancesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.G baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1071,16 +1023,10 @@ func (c *instancesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.G // GetScreenshot returns the screenshot from the specified instance. func (c *instancesRESTClient) GetScreenshot(ctx context.Context, req *computepb.GetScreenshotInstanceRequest, opts ...gax.CallOption) (*computepb.Screenshot, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/screenshot", req.GetProject(), req.GetZone(), req.GetInstance()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1114,12 +1060,6 @@ func (c *instancesRESTClient) GetScreenshot(ctx context.Context, req *computepb. // GetSerialPortOutput returns the last 1 MB of serial port output from the specified instance. func (c *instancesRESTClient) GetSerialPortOutput(ctx context.Context, req *computepb.GetSerialPortOutputInstanceRequest, opts ...gax.CallOption) (*computepb.SerialPortOutput, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/serialPort", req.GetProject(), req.GetZone(), req.GetInstance()) @@ -1133,7 +1073,7 @@ func (c *instancesRESTClient) GetSerialPortOutput(ctx context.Context, req *comp baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1167,16 +1107,10 @@ func (c *instancesRESTClient) GetSerialPortOutput(ctx context.Context, req *comp // GetShieldedInstanceIdentity returns the Shielded Instance Identity of an instance func (c *instancesRESTClient) GetShieldedInstanceIdentity(ctx context.Context, req *computepb.GetShieldedInstanceIdentityInstanceRequest, opts ...gax.CallOption) (*computepb.ShieldedInstanceIdentity, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/getShieldedInstanceIdentity", req.GetProject(), req.GetZone(), req.GetInstance()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1264,12 +1198,6 @@ func (c *instancesRESTClient) Insert(ctx context.Context, req *computepb.InsertI // List retrieves the list of instances contained within the specified zone. func (c *instancesRESTClient) List(ctx context.Context, req *computepb.ListInstancesRequest, opts ...gax.CallOption) (*computepb.InstanceList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances", req.GetProject(), req.GetZone()) @@ -1292,7 +1220,7 @@ func (c *instancesRESTClient) List(ctx context.Context, req *computepb.ListInsta baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1326,12 +1254,6 @@ func (c *instancesRESTClient) List(ctx context.Context, req *computepb.ListInsta // ListReferrers retrieves a list of resources that refer to the VM instance specified in the request. For example, if the VM instance is part of a managed or unmanaged instance group, the referrers list includes the instance group. For more information, read Viewing referrers to VM instances. func (c *instancesRESTClient) ListReferrers(ctx context.Context, req *computepb.ListReferrersInstancesRequest, opts ...gax.CallOption) (*computepb.InstanceListReferrers, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/referrers", req.GetProject(), req.GetZone(), req.GetInstance()) @@ -1354,7 +1276,7 @@ func (c *instancesRESTClient) ListReferrers(ctx context.Context, req *computepb. baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1439,12 +1361,6 @@ func (c *instancesRESTClient) RemoveResourcePolicies(ctx context.Context, req *c // Reset performs a reset on the instance. This is a hard reset the VM does not do a graceful shutdown. For more information, see Resetting an instance. func (c *instancesRESTClient) Reset(ctx context.Context, req *computepb.ResetInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/reset", req.GetProject(), req.GetZone(), req.GetInstance()) @@ -1455,7 +1371,7 @@ func (c *instancesRESTClient) Reset(ctx context.Context, req *computepb.ResetIns baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1489,12 +1405,6 @@ func (c *instancesRESTClient) Reset(ctx context.Context, req *computepb.ResetIns // SetDeletionProtection sets deletion protection on the instance. func (c *instancesRESTClient) SetDeletionProtection(ctx context.Context, req *computepb.SetDeletionProtectionInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setDeletionProtection", req.GetProject(), req.GetZone(), req.GetResource()) @@ -1508,7 +1418,7 @@ func (c *instancesRESTClient) SetDeletionProtection(ctx context.Context, req *co baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1542,12 +1452,6 @@ func (c *instancesRESTClient) SetDeletionProtection(ctx context.Context, req *co // SetDiskAutoDelete sets the auto-delete flag for a disk attached to an instance. func (c *instancesRESTClient) SetDiskAutoDelete(ctx context.Context, req *computepb.SetDiskAutoDeleteInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/setDiskAutoDelete", req.GetProject(), req.GetZone(), req.GetInstance()) @@ -1564,7 +1468,7 @@ func (c *instancesRESTClient) SetDiskAutoDelete(ctx context.Context, req *comput baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -2101,16 +2005,10 @@ func (c *instancesRESTClient) SetTags(ctx context.Context, req *computepb.SetTag // SimulateMaintenanceEvent simulates a maintenance event on the instance. func (c *instancesRESTClient) SimulateMaintenanceEvent(ctx context.Context, req *computepb.SimulateMaintenanceEventInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/simulateMaintenanceEvent", req.GetProject(), req.GetZone(), req.GetInstance()) - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -2144,12 +2042,6 @@ func (c *instancesRESTClient) SimulateMaintenanceEvent(ctx context.Context, req // Start starts an instance that was stopped using the instances().stop method. For more information, see Restart an instance. func (c *instancesRESTClient) Start(ctx context.Context, req *computepb.StartInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/start", req.GetProject(), req.GetZone(), req.GetInstance()) @@ -2160,7 +2052,7 @@ func (c *instancesRESTClient) Start(ctx context.Context, req *computepb.StartIns baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -2245,12 +2137,6 @@ func (c *instancesRESTClient) StartWithEncryptionKey(ctx context.Context, req *c // Stop stops a running instance, shutting it down cleanly, and allows you to restart the instance at a later time. Stopped instances do not incur VM usage charges while they are stopped. However, resources that the VM is using, such as persistent disks and static IP addresses, will continue to be charged until they are deleted. For more information, see Stopping an instance. func (c *instancesRESTClient) Stop(ctx context.Context, req *computepb.StopInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/instances/%v/stop", req.GetProject(), req.GetZone(), req.GetInstance()) @@ -2261,7 +2147,7 @@ func (c *instancesRESTClient) Stop(ctx context.Context, req *computepb.StopInsta baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/interconnect_attachments_client.go b/compute/apiv1/interconnect_attachments_client.go index 017f933fde0..6d4ebaf2cd8 100644 --- a/compute/apiv1/interconnect_attachments_client.go +++ b/compute/apiv1/interconnect_attachments_client.go @@ -156,8 +156,8 @@ func NewInterconnectAttachmentsRESTClient(ctx context.Context, opts ...option.Cl func defaultInterconnectAttachmentsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -189,12 +189,6 @@ func (c *interconnectAttachmentsRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of interconnect attachments. func (c *interconnectAttachmentsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListInterconnectAttachmentsRequest, opts ...gax.CallOption) (*computepb.InterconnectAttachmentAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/interconnectAttachments", req.GetProject()) @@ -220,7 +214,7 @@ func (c *interconnectAttachmentsRESTClient) AggregatedList(ctx context.Context, baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -254,12 +248,6 @@ func (c *interconnectAttachmentsRESTClient) AggregatedList(ctx context.Context, // Delete deletes the specified interconnect attachment. func (c *interconnectAttachmentsRESTClient) Delete(ctx context.Context, req *computepb.DeleteInterconnectAttachmentRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/interconnectAttachments/%v", req.GetProject(), req.GetRegion(), req.GetInterconnectAttachment()) @@ -270,7 +258,7 @@ func (c *interconnectAttachmentsRESTClient) Delete(ctx context.Context, req *com baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -304,16 +292,10 @@ func (c *interconnectAttachmentsRESTClient) Delete(ctx context.Context, req *com // Get returns the specified interconnect attachment. func (c *interconnectAttachmentsRESTClient) Get(ctx context.Context, req *computepb.GetInterconnectAttachmentRequest, opts ...gax.CallOption) (*computepb.InterconnectAttachment, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/interconnectAttachments/%v", req.GetProject(), req.GetRegion(), req.GetInterconnectAttachment()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -401,12 +383,6 @@ func (c *interconnectAttachmentsRESTClient) Insert(ctx context.Context, req *com // List retrieves the list of interconnect attachments contained within the specified region. func (c *interconnectAttachmentsRESTClient) List(ctx context.Context, req *computepb.ListInterconnectAttachmentsRequest, opts ...gax.CallOption) (*computepb.InterconnectAttachmentList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/interconnectAttachments", req.GetProject(), req.GetRegion()) @@ -429,7 +405,7 @@ func (c *interconnectAttachmentsRESTClient) List(ctx context.Context, req *compu baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/interconnect_locations_client.go b/compute/apiv1/interconnect_locations_client.go index cf535f106e4..0e42808c576 100644 --- a/compute/apiv1/interconnect_locations_client.go +++ b/compute/apiv1/interconnect_locations_client.go @@ -17,7 +17,6 @@ package compute import ( - "bytes" "context" "fmt" "io/ioutil" @@ -128,8 +127,8 @@ func NewInterconnectLocationsRESTClient(ctx context.Context, opts ...option.Clie func defaultInterconnectLocationsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -161,16 +160,10 @@ func (c *interconnectLocationsRESTClient) Connection() *grpc.ClientConn { // Get returns the details for the specified interconnect location. Gets a list of available interconnect locations by making a list() request. func (c *interconnectLocationsRESTClient) Get(ctx context.Context, req *computepb.GetInterconnectLocationRequest, opts ...gax.CallOption) (*computepb.InterconnectLocation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnectLocations/%v", req.GetProject(), req.GetInterconnectLocation()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -204,12 +197,6 @@ func (c *interconnectLocationsRESTClient) Get(ctx context.Context, req *computep // List retrieves the list of interconnect locations available to the specified project. func (c *interconnectLocationsRESTClient) List(ctx context.Context, req *computepb.ListInterconnectLocationsRequest, opts ...gax.CallOption) (*computepb.InterconnectLocationList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnectLocations", req.GetProject()) @@ -232,7 +219,7 @@ func (c *interconnectLocationsRESTClient) List(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/interconnects_client.go b/compute/apiv1/interconnects_client.go index 26fa2f16ccb..503b60abf97 100644 --- a/compute/apiv1/interconnects_client.go +++ b/compute/apiv1/interconnects_client.go @@ -156,8 +156,8 @@ func NewInterconnectsRESTClient(ctx context.Context, opts ...option.ClientOption func defaultInterconnectsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -189,12 +189,6 @@ func (c *interconnectsRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified interconnect. func (c *interconnectsRESTClient) Delete(ctx context.Context, req *computepb.DeleteInterconnectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnects/%v", req.GetProject(), req.GetInterconnect()) @@ -205,7 +199,7 @@ func (c *interconnectsRESTClient) Delete(ctx context.Context, req *computepb.Del baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -239,16 +233,10 @@ func (c *interconnectsRESTClient) Delete(ctx context.Context, req *computepb.Del // Get returns the specified interconnect. Get a list of available interconnects by making a list() request. func (c *interconnectsRESTClient) Get(ctx context.Context, req *computepb.GetInterconnectRequest, opts ...gax.CallOption) (*computepb.Interconnect, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnects/%v", req.GetProject(), req.GetInterconnect()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -282,16 +270,10 @@ func (c *interconnectsRESTClient) Get(ctx context.Context, req *computepb.GetInt // GetDiagnostics returns the interconnectDiagnostics for the specified interconnect. func (c *interconnectsRESTClient) GetDiagnostics(ctx context.Context, req *computepb.GetDiagnosticsInterconnectRequest, opts ...gax.CallOption) (*computepb.InterconnectsGetDiagnosticsResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnects/%v/getDiagnostics", req.GetProject(), req.GetInterconnect()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -376,12 +358,6 @@ func (c *interconnectsRESTClient) Insert(ctx context.Context, req *computepb.Ins // List retrieves the list of interconnect available to the specified project. func (c *interconnectsRESTClient) List(ctx context.Context, req *computepb.ListInterconnectsRequest, opts ...gax.CallOption) (*computepb.InterconnectList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/interconnects", req.GetProject()) @@ -404,7 +380,7 @@ func (c *interconnectsRESTClient) List(ctx context.Context, req *computepb.ListI baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/license_codes_client.go b/compute/apiv1/license_codes_client.go index b87bb61e79e..15e4c5c9aa3 100644 --- a/compute/apiv1/license_codes_client.go +++ b/compute/apiv1/license_codes_client.go @@ -128,8 +128,8 @@ func NewLicenseCodesRESTClient(ctx context.Context, opts ...option.ClientOption) func defaultLicenseCodesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -161,16 +161,10 @@ func (c *licenseCodesRESTClient) Connection() *grpc.ClientConn { // Get return a specified license code. License codes are mirrored across all projects that have permissions to read the License Code. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. func (c *licenseCodesRESTClient) Get(ctx context.Context, req *computepb.GetLicenseCodeRequest, opts ...gax.CallOption) (*computepb.LicenseCode, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenseCodes/%v", req.GetProject(), req.GetLicenseCode()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/licenses_client.go b/compute/apiv1/licenses_client.go index f2f2ed9c292..f4ca4f40803 100644 --- a/compute/apiv1/licenses_client.go +++ b/compute/apiv1/licenses_client.go @@ -163,8 +163,8 @@ func NewLicensesRESTClient(ctx context.Context, opts ...option.ClientOption) (*L func defaultLicensesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -196,12 +196,6 @@ func (c *licensesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified license. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. func (c *licensesRESTClient) Delete(ctx context.Context, req *computepb.DeleteLicenseRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses/%v", req.GetProject(), req.GetLicense()) @@ -212,7 +206,7 @@ func (c *licensesRESTClient) Delete(ctx context.Context, req *computepb.DeleteLi baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -246,16 +240,10 @@ func (c *licensesRESTClient) Delete(ctx context.Context, req *computepb.DeleteLi // Get returns the specified License resource. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. func (c *licensesRESTClient) Get(ctx context.Context, req *computepb.GetLicenseRequest, opts ...gax.CallOption) (*computepb.License, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses/%v", req.GetProject(), req.GetLicense()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -289,12 +277,6 @@ func (c *licensesRESTClient) Get(ctx context.Context, req *computepb.GetLicenseR // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. func (c *licensesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyLicenseRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses/%v/getIamPolicy", req.GetProject(), req.GetResource()) @@ -305,7 +287,7 @@ func (c *licensesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.Ge baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -390,12 +372,6 @@ func (c *licensesRESTClient) Insert(ctx context.Context, req *computepb.InsertLi // List retrieves the list of licenses available in the specified project. This method does not get any licenses that belong to other projects, including licenses attached to publicly-available images, like Debian 9. If you want to get a list of publicly-available licenses, use this method to make a request to the respective image project, such as debian-cloud or windows-cloud. Caution This resource is intended for use only by third-party partners who are creating Cloud Marketplace images. func (c *licensesRESTClient) List(ctx context.Context, req *computepb.ListLicensesRequest, opts ...gax.CallOption) (*computepb.LicensesListResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/licenses", req.GetProject()) @@ -418,7 +394,7 @@ func (c *licensesRESTClient) List(ctx context.Context, req *computepb.ListLicens baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/machine_types_client.go b/compute/apiv1/machine_types_client.go index b888cabec5b..22b9b2e9607 100644 --- a/compute/apiv1/machine_types_client.go +++ b/compute/apiv1/machine_types_client.go @@ -17,7 +17,6 @@ package compute import ( - "bytes" "context" "fmt" "io/ioutil" @@ -135,8 +134,8 @@ func NewMachineTypesRESTClient(ctx context.Context, opts ...option.ClientOption) func defaultMachineTypesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -168,12 +167,6 @@ func (c *machineTypesRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of machine types. func (c *machineTypesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListMachineTypesRequest, opts ...gax.CallOption) (*computepb.MachineTypeAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/machineTypes", req.GetProject()) @@ -199,7 +192,7 @@ func (c *machineTypesRESTClient) AggregatedList(ctx context.Context, req *comput baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -233,16 +226,10 @@ func (c *machineTypesRESTClient) AggregatedList(ctx context.Context, req *comput // Get returns the specified machine type. Gets a list of available machine types by making a list() request. func (c *machineTypesRESTClient) Get(ctx context.Context, req *computepb.GetMachineTypeRequest, opts ...gax.CallOption) (*computepb.MachineType, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/machineTypes/%v", req.GetProject(), req.GetZone(), req.GetMachineType()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -276,12 +263,6 @@ func (c *machineTypesRESTClient) Get(ctx context.Context, req *computepb.GetMach // List retrieves a list of machine types available to the specified project. func (c *machineTypesRESTClient) List(ctx context.Context, req *computepb.ListMachineTypesRequest, opts ...gax.CallOption) (*computepb.MachineTypeList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/machineTypes", req.GetProject(), req.GetZone()) @@ -304,7 +285,7 @@ func (c *machineTypesRESTClient) List(ctx context.Context, req *computepb.ListMa baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/network_endpoint_groups_client.go b/compute/apiv1/network_endpoint_groups_client.go index f9da210d93a..6029f50399f 100644 --- a/compute/apiv1/network_endpoint_groups_client.go +++ b/compute/apiv1/network_endpoint_groups_client.go @@ -177,8 +177,8 @@ func NewNetworkEndpointGroupsRESTClient(ctx context.Context, opts ...option.Clie func defaultNetworkEndpointGroupsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -210,12 +210,6 @@ func (c *networkEndpointGroupsRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves the list of network endpoint groups and sorts them by zone. func (c *networkEndpointGroupsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/networkEndpointGroups", req.GetProject()) @@ -241,7 +235,7 @@ func (c *networkEndpointGroupsRESTClient) AggregatedList(ctx context.Context, re baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -326,12 +320,6 @@ func (c *networkEndpointGroupsRESTClient) AttachNetworkEndpoints(ctx context.Con // Delete deletes the specified network endpoint group. The network endpoints in the NEG and the VM instances they belong to are not terminated when the NEG is deleted. Note that the NEG cannot be deleted if there are backend services referencing it. func (c *networkEndpointGroupsRESTClient) Delete(ctx context.Context, req *computepb.DeleteNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/networkEndpointGroups/%v", req.GetProject(), req.GetZone(), req.GetNetworkEndpointGroup()) @@ -342,7 +330,7 @@ func (c *networkEndpointGroupsRESTClient) Delete(ctx context.Context, req *compu baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -427,16 +415,10 @@ func (c *networkEndpointGroupsRESTClient) DetachNetworkEndpoints(ctx context.Con // Get returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request. func (c *networkEndpointGroupsRESTClient) Get(ctx context.Context, req *computepb.GetNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroup, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/networkEndpointGroups/%v", req.GetProject(), req.GetZone(), req.GetNetworkEndpointGroup()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -521,12 +503,6 @@ func (c *networkEndpointGroupsRESTClient) Insert(ctx context.Context, req *compu // List retrieves the list of network endpoint groups that are located in the specified project and zone. func (c *networkEndpointGroupsRESTClient) List(ctx context.Context, req *computepb.ListNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/networkEndpointGroups", req.GetProject(), req.GetZone()) @@ -549,7 +525,7 @@ func (c *networkEndpointGroupsRESTClient) List(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/networks_client.go b/compute/apiv1/networks_client.go index 432e0e8047f..61a201d8461 100644 --- a/compute/apiv1/networks_client.go +++ b/compute/apiv1/networks_client.go @@ -191,8 +191,8 @@ func NewNetworksRESTClient(ctx context.Context, opts ...option.ClientOption) (*N func defaultNetworksRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -275,12 +275,6 @@ func (c *networksRESTClient) AddPeering(ctx context.Context, req *computepb.AddP // Delete deletes the specified network. func (c *networksRESTClient) Delete(ctx context.Context, req *computepb.DeleteNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v", req.GetProject(), req.GetNetwork()) @@ -291,7 +285,7 @@ func (c *networksRESTClient) Delete(ctx context.Context, req *computepb.DeleteNe baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -325,16 +319,10 @@ func (c *networksRESTClient) Delete(ctx context.Context, req *computepb.DeleteNe // Get returns the specified network. Gets a list of available networks by making a list() request. func (c *networksRESTClient) Get(ctx context.Context, req *computepb.GetNetworkRequest, opts ...gax.CallOption) (*computepb.Network, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v", req.GetProject(), req.GetNetwork()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -368,16 +356,10 @@ func (c *networksRESTClient) Get(ctx context.Context, req *computepb.GetNetworkR // GetEffectiveFirewalls returns the effective firewalls on a given network. func (c *networksRESTClient) GetEffectiveFirewalls(ctx context.Context, req *computepb.GetEffectiveFirewallsNetworkRequest, opts ...gax.CallOption) (*computepb.NetworksGetEffectiveFirewallsResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v/getEffectiveFirewalls", req.GetProject(), req.GetNetwork()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -462,12 +444,6 @@ func (c *networksRESTClient) Insert(ctx context.Context, req *computepb.InsertNe // List retrieves the list of networks available to the specified project. func (c *networksRESTClient) List(ctx context.Context, req *computepb.ListNetworksRequest, opts ...gax.CallOption) (*computepb.NetworkList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks", req.GetProject()) @@ -490,7 +466,7 @@ func (c *networksRESTClient) List(ctx context.Context, req *computepb.ListNetwor baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -524,12 +500,6 @@ func (c *networksRESTClient) List(ctx context.Context, req *computepb.ListNetwor // ListPeeringRoutes lists the peering routes exchanged over peering connection. func (c *networksRESTClient) ListPeeringRoutes(ctx context.Context, req *computepb.ListPeeringRoutesNetworksRequest, opts ...gax.CallOption) (*computepb.ExchangedPeeringRoutesList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v/listPeeringRoutes", req.GetProject(), req.GetNetwork()) @@ -561,7 +531,7 @@ func (c *networksRESTClient) ListPeeringRoutes(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -697,12 +667,6 @@ func (c *networksRESTClient) RemovePeering(ctx context.Context, req *computepb.R // SwitchToCustomMode switches the network mode from auto subnet mode to custom subnet mode. func (c *networksRESTClient) SwitchToCustomMode(ctx context.Context, req *computepb.SwitchToCustomModeNetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/networks/%v/switchToCustomMode", req.GetProject(), req.GetNetwork()) @@ -713,7 +677,7 @@ func (c *networksRESTClient) SwitchToCustomMode(ctx context.Context, req *comput baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/node_groups_client.go b/compute/apiv1/node_groups_client.go index 64563885daa..a306a111b2b 100644 --- a/compute/apiv1/node_groups_client.go +++ b/compute/apiv1/node_groups_client.go @@ -205,8 +205,8 @@ func NewNodeGroupsRESTClient(ctx context.Context, opts ...option.ClientOption) ( func defaultNodeGroupsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -289,12 +289,6 @@ func (c *nodeGroupsRESTClient) AddNodes(ctx context.Context, req *computepb.AddN // AggregatedList retrieves an aggregated list of node groups. Note: use nodeGroups.listNodes for more details about each group. func (c *nodeGroupsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListNodeGroupsRequest, opts ...gax.CallOption) (*computepb.NodeGroupAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/nodeGroups", req.GetProject()) @@ -320,7 +314,7 @@ func (c *nodeGroupsRESTClient) AggregatedList(ctx context.Context, req *computep baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -354,12 +348,6 @@ func (c *nodeGroupsRESTClient) AggregatedList(ctx context.Context, req *computep // Delete deletes the specified NodeGroup resource. func (c *nodeGroupsRESTClient) Delete(ctx context.Context, req *computepb.DeleteNodeGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v", req.GetProject(), req.GetZone(), req.GetNodeGroup()) @@ -370,7 +358,7 @@ func (c *nodeGroupsRESTClient) Delete(ctx context.Context, req *computepb.Delete baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -455,16 +443,10 @@ func (c *nodeGroupsRESTClient) DeleteNodes(ctx context.Context, req *computepb.D // Get returns the specified NodeGroup. Get a list of available NodeGroups by making a list() request. Note: the “nodes” field should not be used. Use nodeGroups.listNodes instead. func (c *nodeGroupsRESTClient) Get(ctx context.Context, req *computepb.GetNodeGroupRequest, opts ...gax.CallOption) (*computepb.NodeGroup, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v", req.GetProject(), req.GetZone(), req.GetNodeGroup()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -498,12 +480,6 @@ func (c *nodeGroupsRESTClient) Get(ctx context.Context, req *computepb.GetNodeGr // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. func (c *nodeGroupsRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyNodeGroupRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v/getIamPolicy", req.GetProject(), req.GetZone(), req.GetResource()) @@ -514,7 +490,7 @@ func (c *nodeGroupsRESTClient) GetIamPolicy(ctx context.Context, req *computepb. baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -602,12 +578,6 @@ func (c *nodeGroupsRESTClient) Insert(ctx context.Context, req *computepb.Insert // List retrieves a list of node groups available to the specified project. Note: use nodeGroups.listNodes for more details about each group. func (c *nodeGroupsRESTClient) List(ctx context.Context, req *computepb.ListNodeGroupsRequest, opts ...gax.CallOption) (*computepb.NodeGroupList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups", req.GetProject(), req.GetZone()) @@ -630,7 +600,7 @@ func (c *nodeGroupsRESTClient) List(ctx context.Context, req *computepb.ListNode baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -664,12 +634,6 @@ func (c *nodeGroupsRESTClient) List(ctx context.Context, req *computepb.ListNode // ListNodes lists nodes in the node group. func (c *nodeGroupsRESTClient) ListNodes(ctx context.Context, req *computepb.ListNodesNodeGroupsRequest, opts ...gax.CallOption) (*computepb.NodeGroupsListNodes, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeGroups/%v/listNodes", req.GetProject(), req.GetZone(), req.GetNodeGroup()) @@ -692,7 +656,7 @@ func (c *nodeGroupsRESTClient) ListNodes(ctx context.Context, req *computepb.Lis baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/node_templates_client.go b/compute/apiv1/node_templates_client.go index eebf6d2a0a0..e9e2f5ed310 100644 --- a/compute/apiv1/node_templates_client.go +++ b/compute/apiv1/node_templates_client.go @@ -170,8 +170,8 @@ func NewNodeTemplatesRESTClient(ctx context.Context, opts ...option.ClientOption func defaultNodeTemplatesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -203,12 +203,6 @@ func (c *nodeTemplatesRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of node templates. func (c *nodeTemplatesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListNodeTemplatesRequest, opts ...gax.CallOption) (*computepb.NodeTemplateAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/nodeTemplates", req.GetProject()) @@ -234,7 +228,7 @@ func (c *nodeTemplatesRESTClient) AggregatedList(ctx context.Context, req *compu baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -268,12 +262,6 @@ func (c *nodeTemplatesRESTClient) AggregatedList(ctx context.Context, req *compu // Delete deletes the specified NodeTemplate resource. func (c *nodeTemplatesRESTClient) Delete(ctx context.Context, req *computepb.DeleteNodeTemplateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/nodeTemplates/%v", req.GetProject(), req.GetRegion(), req.GetNodeTemplate()) @@ -284,7 +272,7 @@ func (c *nodeTemplatesRESTClient) Delete(ctx context.Context, req *computepb.Del baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -318,16 +306,10 @@ func (c *nodeTemplatesRESTClient) Delete(ctx context.Context, req *computepb.Del // Get returns the specified node template. Gets a list of available node templates by making a list() request. func (c *nodeTemplatesRESTClient) Get(ctx context.Context, req *computepb.GetNodeTemplateRequest, opts ...gax.CallOption) (*computepb.NodeTemplate, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/nodeTemplates/%v", req.GetProject(), req.GetRegion(), req.GetNodeTemplate()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -361,12 +343,6 @@ func (c *nodeTemplatesRESTClient) Get(ctx context.Context, req *computepb.GetNod // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. func (c *nodeTemplatesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyNodeTemplateRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/nodeTemplates/%v/getIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource()) @@ -377,7 +353,7 @@ func (c *nodeTemplatesRESTClient) GetIamPolicy(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -462,12 +438,6 @@ func (c *nodeTemplatesRESTClient) Insert(ctx context.Context, req *computepb.Ins // List retrieves a list of node templates available to the specified project. func (c *nodeTemplatesRESTClient) List(ctx context.Context, req *computepb.ListNodeTemplatesRequest, opts ...gax.CallOption) (*computepb.NodeTemplateList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/nodeTemplates", req.GetProject(), req.GetRegion()) @@ -490,7 +460,7 @@ func (c *nodeTemplatesRESTClient) List(ctx context.Context, req *computepb.ListN baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/node_types_client.go b/compute/apiv1/node_types_client.go index 5c72753393b..97b80ae2eb2 100644 --- a/compute/apiv1/node_types_client.go +++ b/compute/apiv1/node_types_client.go @@ -17,7 +17,6 @@ package compute import ( - "bytes" "context" "fmt" "io/ioutil" @@ -135,8 +134,8 @@ func NewNodeTypesRESTClient(ctx context.Context, opts ...option.ClientOption) (* func defaultNodeTypesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -168,12 +167,6 @@ func (c *nodeTypesRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of node types. func (c *nodeTypesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListNodeTypesRequest, opts ...gax.CallOption) (*computepb.NodeTypeAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/nodeTypes", req.GetProject()) @@ -199,7 +192,7 @@ func (c *nodeTypesRESTClient) AggregatedList(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -233,16 +226,10 @@ func (c *nodeTypesRESTClient) AggregatedList(ctx context.Context, req *computepb // Get returns the specified node type. Gets a list of available node types by making a list() request. func (c *nodeTypesRESTClient) Get(ctx context.Context, req *computepb.GetNodeTypeRequest, opts ...gax.CallOption) (*computepb.NodeType, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeTypes/%v", req.GetProject(), req.GetZone(), req.GetNodeType()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -276,12 +263,6 @@ func (c *nodeTypesRESTClient) Get(ctx context.Context, req *computepb.GetNodeTyp // List retrieves a list of node types available to the specified project. func (c *nodeTypesRESTClient) List(ctx context.Context, req *computepb.ListNodeTypesRequest, opts ...gax.CallOption) (*computepb.NodeTypeList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/nodeTypes", req.GetProject(), req.GetZone()) @@ -304,7 +285,7 @@ func (c *nodeTypesRESTClient) List(ctx context.Context, req *computepb.ListNodeT baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/packet_mirrorings_client.go b/compute/apiv1/packet_mirrorings_client.go index 2ddda96fccb..169aa037c42 100644 --- a/compute/apiv1/packet_mirrorings_client.go +++ b/compute/apiv1/packet_mirrorings_client.go @@ -163,8 +163,8 @@ func NewPacketMirroringsRESTClient(ctx context.Context, opts ...option.ClientOpt func defaultPacketMirroringsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -196,12 +196,6 @@ func (c *packetMirroringsRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of packetMirrorings. func (c *packetMirroringsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListPacketMirroringsRequest, opts ...gax.CallOption) (*computepb.PacketMirroringAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/packetMirrorings", req.GetProject()) @@ -227,7 +221,7 @@ func (c *packetMirroringsRESTClient) AggregatedList(ctx context.Context, req *co baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -261,12 +255,6 @@ func (c *packetMirroringsRESTClient) AggregatedList(ctx context.Context, req *co // Delete deletes the specified PacketMirroring resource. func (c *packetMirroringsRESTClient) Delete(ctx context.Context, req *computepb.DeletePacketMirroringRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/packetMirrorings/%v", req.GetProject(), req.GetRegion(), req.GetPacketMirroring()) @@ -277,7 +265,7 @@ func (c *packetMirroringsRESTClient) Delete(ctx context.Context, req *computepb. baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -311,16 +299,10 @@ func (c *packetMirroringsRESTClient) Delete(ctx context.Context, req *computepb. // Get returns the specified PacketMirroring resource. func (c *packetMirroringsRESTClient) Get(ctx context.Context, req *computepb.GetPacketMirroringRequest, opts ...gax.CallOption) (*computepb.PacketMirroring, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/packetMirrorings/%v", req.GetProject(), req.GetRegion(), req.GetPacketMirroring()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -405,12 +387,6 @@ func (c *packetMirroringsRESTClient) Insert(ctx context.Context, req *computepb. // List retrieves a list of PacketMirroring resources available to the specified project and region. func (c *packetMirroringsRESTClient) List(ctx context.Context, req *computepb.ListPacketMirroringsRequest, opts ...gax.CallOption) (*computepb.PacketMirroringList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/packetMirrorings", req.GetProject(), req.GetRegion()) @@ -433,7 +409,7 @@ func (c *packetMirroringsRESTClient) List(ctx context.Context, req *computepb.Li baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/projects_client.go b/compute/apiv1/projects_client.go index 03d1aa434da..270aae1768e 100644 --- a/compute/apiv1/projects_client.go +++ b/compute/apiv1/projects_client.go @@ -205,8 +205,8 @@ func NewProjectsRESTClient(ctx context.Context, opts ...option.ClientOption) (*P func defaultProjectsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -238,12 +238,6 @@ func (c *projectsRESTClient) Connection() *grpc.ClientConn { // DisableXpnHost disable this project as a shared VPC host project. func (c *projectsRESTClient) DisableXpnHost(ctx context.Context, req *computepb.DisableXpnHostProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/disableXpnHost", req.GetProject()) @@ -254,7 +248,7 @@ func (c *projectsRESTClient) DisableXpnHost(ctx context.Context, req *computepb. baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -339,12 +333,6 @@ func (c *projectsRESTClient) DisableXpnResource(ctx context.Context, req *comput // EnableXpnHost enable this project as a shared VPC host project. func (c *projectsRESTClient) EnableXpnHost(ctx context.Context, req *computepb.EnableXpnHostProjectRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/enableXpnHost", req.GetProject()) @@ -355,7 +343,7 @@ func (c *projectsRESTClient) EnableXpnHost(ctx context.Context, req *computepb.E baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -440,16 +428,10 @@ func (c *projectsRESTClient) EnableXpnResource(ctx context.Context, req *compute // Get returns the specified Project resource. func (c *projectsRESTClient) Get(ctx context.Context, req *computepb.GetProjectRequest, opts ...gax.CallOption) (*computepb.Project, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v", req.GetProject()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -483,16 +465,10 @@ func (c *projectsRESTClient) Get(ctx context.Context, req *computepb.GetProjectR // GetXpnHost gets the shared VPC host project that this project links to. May be empty if no link exists. func (c *projectsRESTClient) GetXpnHost(ctx context.Context, req *computepb.GetXpnHostProjectRequest, opts ...gax.CallOption) (*computepb.Project, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/getXpnHost", req.GetProject()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -526,12 +502,6 @@ func (c *projectsRESTClient) GetXpnHost(ctx context.Context, req *computepb.GetX // GetXpnResources gets service resources (a.k.a service project) associated with this host project. func (c *projectsRESTClient) GetXpnResources(ctx context.Context, req *computepb.GetXpnResourcesProjectsRequest, opts ...gax.CallOption) (*computepb.ProjectsGetXpnResources, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/getXpnResources", req.GetProject()) @@ -554,7 +524,7 @@ func (c *projectsRESTClient) GetXpnResources(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/public_advertised_prefixes_client.go b/compute/apiv1/public_advertised_prefixes_client.go index 01f9fa03d1e..1312ce9c57a 100644 --- a/compute/apiv1/public_advertised_prefixes_client.go +++ b/compute/apiv1/public_advertised_prefixes_client.go @@ -149,8 +149,8 @@ func NewPublicAdvertisedPrefixesRESTClient(ctx context.Context, opts ...option.C func defaultPublicAdvertisedPrefixesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -182,12 +182,6 @@ func (c *publicAdvertisedPrefixesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified PublicAdvertisedPrefix func (c *publicAdvertisedPrefixesRESTClient) Delete(ctx context.Context, req *computepb.DeletePublicAdvertisedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicAdvertisedPrefixes/%v", req.GetProject(), req.GetPublicAdvertisedPrefix()) @@ -198,7 +192,7 @@ func (c *publicAdvertisedPrefixesRESTClient) Delete(ctx context.Context, req *co baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -232,16 +226,10 @@ func (c *publicAdvertisedPrefixesRESTClient) Delete(ctx context.Context, req *co // Get returns the specified PublicAdvertisedPrefix resource. func (c *publicAdvertisedPrefixesRESTClient) Get(ctx context.Context, req *computepb.GetPublicAdvertisedPrefixeRequest, opts ...gax.CallOption) (*computepb.PublicAdvertisedPrefix, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicAdvertisedPrefixes/%v", req.GetProject(), req.GetPublicAdvertisedPrefix()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -326,12 +314,6 @@ func (c *publicAdvertisedPrefixesRESTClient) Insert(ctx context.Context, req *co // List lists the PublicAdvertisedPrefixes for a project. func (c *publicAdvertisedPrefixesRESTClient) List(ctx context.Context, req *computepb.ListPublicAdvertisedPrefixesRequest, opts ...gax.CallOption) (*computepb.PublicAdvertisedPrefixList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/publicAdvertisedPrefixes", req.GetProject()) @@ -354,7 +336,7 @@ func (c *publicAdvertisedPrefixesRESTClient) List(ctx context.Context, req *comp baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/public_delegated_prefixes_client.go b/compute/apiv1/public_delegated_prefixes_client.go index 5a186c8800e..5dcb3429706 100644 --- a/compute/apiv1/public_delegated_prefixes_client.go +++ b/compute/apiv1/public_delegated_prefixes_client.go @@ -156,8 +156,8 @@ func NewPublicDelegatedPrefixesRESTClient(ctx context.Context, opts ...option.Cl func defaultPublicDelegatedPrefixesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -189,12 +189,6 @@ func (c *publicDelegatedPrefixesRESTClient) Connection() *grpc.ClientConn { // AggregatedList lists all PublicDelegatedPrefix resources owned by the specific project across all scopes. func (c *publicDelegatedPrefixesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListPublicDelegatedPrefixesRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefixAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/publicDelegatedPrefixes", req.GetProject()) @@ -220,7 +214,7 @@ func (c *publicDelegatedPrefixesRESTClient) AggregatedList(ctx context.Context, baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -254,12 +248,6 @@ func (c *publicDelegatedPrefixesRESTClient) AggregatedList(ctx context.Context, // Delete deletes the specified PublicDelegatedPrefix in the given region. func (c *publicDelegatedPrefixesRESTClient) Delete(ctx context.Context, req *computepb.DeletePublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/publicDelegatedPrefixes/%v", req.GetProject(), req.GetRegion(), req.GetPublicDelegatedPrefix()) @@ -270,7 +258,7 @@ func (c *publicDelegatedPrefixesRESTClient) Delete(ctx context.Context, req *com baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -304,16 +292,10 @@ func (c *publicDelegatedPrefixesRESTClient) Delete(ctx context.Context, req *com // Get returns the specified PublicDelegatedPrefix resource in the given region. func (c *publicDelegatedPrefixesRESTClient) Get(ctx context.Context, req *computepb.GetPublicDelegatedPrefixeRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefix, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/publicDelegatedPrefixes/%v", req.GetProject(), req.GetRegion(), req.GetPublicDelegatedPrefix()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -398,12 +380,6 @@ func (c *publicDelegatedPrefixesRESTClient) Insert(ctx context.Context, req *com // List lists the PublicDelegatedPrefixes for a project in the given region. func (c *publicDelegatedPrefixesRESTClient) List(ctx context.Context, req *computepb.ListPublicDelegatedPrefixesRequest, opts ...gax.CallOption) (*computepb.PublicDelegatedPrefixList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/publicDelegatedPrefixes", req.GetProject(), req.GetRegion()) @@ -426,7 +402,7 @@ func (c *publicDelegatedPrefixesRESTClient) List(ctx context.Context, req *compu baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_autoscalers_client.go b/compute/apiv1/region_autoscalers_client.go index 32c026f5dcc..0455c1cd097 100644 --- a/compute/apiv1/region_autoscalers_client.go +++ b/compute/apiv1/region_autoscalers_client.go @@ -156,8 +156,8 @@ func NewRegionAutoscalersRESTClient(ctx context.Context, opts ...option.ClientOp func defaultRegionAutoscalersRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -189,12 +189,6 @@ func (c *regionAutoscalersRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified autoscaler. func (c *regionAutoscalersRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionAutoscalerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/autoscalers/%v", req.GetProject(), req.GetRegion(), req.GetAutoscaler()) @@ -205,7 +199,7 @@ func (c *regionAutoscalersRESTClient) Delete(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -239,16 +233,10 @@ func (c *regionAutoscalersRESTClient) Delete(ctx context.Context, req *computepb // Get returns the specified autoscaler. func (c *regionAutoscalersRESTClient) Get(ctx context.Context, req *computepb.GetRegionAutoscalerRequest, opts ...gax.CallOption) (*computepb.Autoscaler, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/autoscalers/%v", req.GetProject(), req.GetRegion(), req.GetAutoscaler()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -333,12 +321,6 @@ func (c *regionAutoscalersRESTClient) Insert(ctx context.Context, req *computepb // List retrieves a list of autoscalers contained within the specified region. func (c *regionAutoscalersRESTClient) List(ctx context.Context, req *computepb.ListRegionAutoscalersRequest, opts ...gax.CallOption) (*computepb.RegionAutoscalerList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/autoscalers", req.GetProject(), req.GetRegion()) @@ -361,7 +343,7 @@ func (c *regionAutoscalersRESTClient) List(ctx context.Context, req *computepb.L baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_backend_services_client.go b/compute/apiv1/region_backend_services_client.go index eae95808d2e..01c7bbf6c9a 100644 --- a/compute/apiv1/region_backend_services_client.go +++ b/compute/apiv1/region_backend_services_client.go @@ -163,8 +163,8 @@ func NewRegionBackendServicesRESTClient(ctx context.Context, opts ...option.Clie func defaultRegionBackendServicesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -196,12 +196,6 @@ func (c *regionBackendServicesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified regional BackendService resource. func (c *regionBackendServicesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/backendServices/%v", req.GetProject(), req.GetRegion(), req.GetBackendService()) @@ -212,7 +206,7 @@ func (c *regionBackendServicesRESTClient) Delete(ctx context.Context, req *compu baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -246,16 +240,10 @@ func (c *regionBackendServicesRESTClient) Delete(ctx context.Context, req *compu // Get returns the specified regional BackendService resource. func (c *regionBackendServicesRESTClient) Get(ctx context.Context, req *computepb.GetRegionBackendServiceRequest, opts ...gax.CallOption) (*computepb.BackendService, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/backendServices/%v", req.GetProject(), req.GetRegion(), req.GetBackendService()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -384,12 +372,6 @@ func (c *regionBackendServicesRESTClient) Insert(ctx context.Context, req *compu // List retrieves the list of regional BackendService resources available to the specified project in the given region. func (c *regionBackendServicesRESTClient) List(ctx context.Context, req *computepb.ListRegionBackendServicesRequest, opts ...gax.CallOption) (*computepb.BackendServiceList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/backendServices", req.GetProject(), req.GetRegion()) @@ -412,7 +394,7 @@ func (c *regionBackendServicesRESTClient) List(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_commitments_client.go b/compute/apiv1/region_commitments_client.go index c0990697de2..4b58ada8c7d 100644 --- a/compute/apiv1/region_commitments_client.go +++ b/compute/apiv1/region_commitments_client.go @@ -142,8 +142,8 @@ func NewRegionCommitmentsRESTClient(ctx context.Context, opts ...option.ClientOp func defaultRegionCommitmentsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -175,12 +175,6 @@ func (c *regionCommitmentsRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of commitments. func (c *regionCommitmentsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListRegionCommitmentsRequest, opts ...gax.CallOption) (*computepb.CommitmentAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/commitments", req.GetProject()) @@ -206,7 +200,7 @@ func (c *regionCommitmentsRESTClient) AggregatedList(ctx context.Context, req *c baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -240,16 +234,10 @@ func (c *regionCommitmentsRESTClient) AggregatedList(ctx context.Context, req *c // Get returns the specified commitment resource. Gets a list of available commitments by making a list() request. func (c *regionCommitmentsRESTClient) Get(ctx context.Context, req *computepb.GetRegionCommitmentRequest, opts ...gax.CallOption) (*computepb.Commitment, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/commitments/%v", req.GetProject(), req.GetRegion(), req.GetCommitment()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -334,12 +322,6 @@ func (c *regionCommitmentsRESTClient) Insert(ctx context.Context, req *computepb // List retrieves a list of commitments contained within the specified region. func (c *regionCommitmentsRESTClient) List(ctx context.Context, req *computepb.ListRegionCommitmentsRequest, opts ...gax.CallOption) (*computepb.CommitmentList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/commitments", req.GetProject(), req.GetRegion()) @@ -362,7 +344,7 @@ func (c *regionCommitmentsRESTClient) List(ctx context.Context, req *computepb.L baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_disk_types_client.go b/compute/apiv1/region_disk_types_client.go index cc443bbbbfd..6ee47aaf1fd 100644 --- a/compute/apiv1/region_disk_types_client.go +++ b/compute/apiv1/region_disk_types_client.go @@ -17,7 +17,6 @@ package compute import ( - "bytes" "context" "fmt" "io/ioutil" @@ -128,8 +127,8 @@ func NewRegionDiskTypesRESTClient(ctx context.Context, opts ...option.ClientOpti func defaultRegionDiskTypesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -161,16 +160,10 @@ func (c *regionDiskTypesRESTClient) Connection() *grpc.ClientConn { // Get returns the specified regional disk type. Gets a list of available disk types by making a list() request. func (c *regionDiskTypesRESTClient) Get(ctx context.Context, req *computepb.GetRegionDiskTypeRequest, opts ...gax.CallOption) (*computepb.DiskType, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/diskTypes/%v", req.GetProject(), req.GetRegion(), req.GetDiskType()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -204,12 +197,6 @@ func (c *regionDiskTypesRESTClient) Get(ctx context.Context, req *computepb.GetR // List retrieves a list of regional disk types available to the specified project. func (c *regionDiskTypesRESTClient) List(ctx context.Context, req *computepb.ListRegionDiskTypesRequest, opts ...gax.CallOption) (*computepb.RegionDiskTypeList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/diskTypes", req.GetProject(), req.GetRegion()) @@ -232,7 +219,7 @@ func (c *regionDiskTypesRESTClient) List(ctx context.Context, req *computepb.Lis baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_disks_client.go b/compute/apiv1/region_disks_client.go index 5707403df02..36c1ef96f0d 100644 --- a/compute/apiv1/region_disks_client.go +++ b/compute/apiv1/region_disks_client.go @@ -198,8 +198,8 @@ func NewRegionDisksRESTClient(ctx context.Context, opts ...option.ClientOption) func defaultRegionDisksRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -333,12 +333,6 @@ func (c *regionDisksRESTClient) CreateSnapshot(ctx context.Context, req *compute // Delete deletes the specified regional persistent disk. Deleting a regional disk removes all the replicas of its data permanently and is irreversible. However, deleting a disk does not delete any snapshots previously made from the disk. You must separately delete snapshots. func (c *regionDisksRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionDiskRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v", req.GetProject(), req.GetRegion(), req.GetDisk()) @@ -349,7 +343,7 @@ func (c *regionDisksRESTClient) Delete(ctx context.Context, req *computepb.Delet baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -383,16 +377,10 @@ func (c *regionDisksRESTClient) Delete(ctx context.Context, req *computepb.Delet // Get returns a specified regional persistent disk. func (c *regionDisksRESTClient) Get(ctx context.Context, req *computepb.GetRegionDiskRequest, opts ...gax.CallOption) (*computepb.Disk, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v", req.GetProject(), req.GetRegion(), req.GetDisk()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -426,12 +414,6 @@ func (c *regionDisksRESTClient) Get(ctx context.Context, req *computepb.GetRegio // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. func (c *regionDisksRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyRegionDiskRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks/%v/getIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource()) @@ -442,7 +424,7 @@ func (c *regionDisksRESTClient) GetIamPolicy(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -530,12 +512,6 @@ func (c *regionDisksRESTClient) Insert(ctx context.Context, req *computepb.Inser // List retrieves the list of persistent disks contained within the specified region. func (c *regionDisksRESTClient) List(ctx context.Context, req *computepb.ListRegionDisksRequest, opts ...gax.CallOption) (*computepb.DiskList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/disks", req.GetProject(), req.GetRegion()) @@ -558,7 +534,7 @@ func (c *regionDisksRESTClient) List(ctx context.Context, req *computepb.ListReg baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_health_check_services_client.go b/compute/apiv1/region_health_check_services_client.go index 7e7ece75de3..461ca2f323b 100644 --- a/compute/apiv1/region_health_check_services_client.go +++ b/compute/apiv1/region_health_check_services_client.go @@ -149,8 +149,8 @@ func NewRegionHealthCheckServicesRESTClient(ctx context.Context, opts ...option. func defaultRegionHealthCheckServicesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -182,12 +182,6 @@ func (c *regionHealthCheckServicesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified regional HealthCheckService. func (c *regionHealthCheckServicesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionHealthCheckServiceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthCheckServices/%v", req.GetProject(), req.GetRegion(), req.GetHealthCheckService()) @@ -198,7 +192,7 @@ func (c *regionHealthCheckServicesRESTClient) Delete(ctx context.Context, req *c baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -232,16 +226,10 @@ func (c *regionHealthCheckServicesRESTClient) Delete(ctx context.Context, req *c // Get returns the specified regional HealthCheckService resource. func (c *regionHealthCheckServicesRESTClient) Get(ctx context.Context, req *computepb.GetRegionHealthCheckServiceRequest, opts ...gax.CallOption) (*computepb.HealthCheckService, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthCheckServices/%v", req.GetProject(), req.GetRegion(), req.GetHealthCheckService()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -326,12 +314,6 @@ func (c *regionHealthCheckServicesRESTClient) Insert(ctx context.Context, req *c // List lists all the HealthCheckService resources that have been configured for the specified project in the given region. func (c *regionHealthCheckServicesRESTClient) List(ctx context.Context, req *computepb.ListRegionHealthCheckServicesRequest, opts ...gax.CallOption) (*computepb.HealthCheckServicesList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthCheckServices", req.GetProject(), req.GetRegion()) @@ -354,7 +336,7 @@ func (c *regionHealthCheckServicesRESTClient) List(ctx context.Context, req *com baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_health_checks_client.go b/compute/apiv1/region_health_checks_client.go index 18afaa3dbb3..4d14cc09699 100644 --- a/compute/apiv1/region_health_checks_client.go +++ b/compute/apiv1/region_health_checks_client.go @@ -156,8 +156,8 @@ func NewRegionHealthChecksRESTClient(ctx context.Context, opts ...option.ClientO func defaultRegionHealthChecksRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -189,12 +189,6 @@ func (c *regionHealthChecksRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified HealthCheck resource. func (c *regionHealthChecksRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionHealthCheckRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthChecks/%v", req.GetProject(), req.GetRegion(), req.GetHealthCheck()) @@ -205,7 +199,7 @@ func (c *regionHealthChecksRESTClient) Delete(ctx context.Context, req *computep baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -239,16 +233,10 @@ func (c *regionHealthChecksRESTClient) Delete(ctx context.Context, req *computep // Get returns the specified HealthCheck resource. Gets a list of available health checks by making a list() request. func (c *regionHealthChecksRESTClient) Get(ctx context.Context, req *computepb.GetRegionHealthCheckRequest, opts ...gax.CallOption) (*computepb.HealthCheck, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthChecks/%v", req.GetProject(), req.GetRegion(), req.GetHealthCheck()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -333,12 +321,6 @@ func (c *regionHealthChecksRESTClient) Insert(ctx context.Context, req *computep // List retrieves the list of HealthCheck resources available to the specified project. func (c *regionHealthChecksRESTClient) List(ctx context.Context, req *computepb.ListRegionHealthChecksRequest, opts ...gax.CallOption) (*computepb.HealthCheckList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/healthChecks", req.GetProject(), req.GetRegion()) @@ -361,7 +343,7 @@ func (c *regionHealthChecksRESTClient) List(ctx context.Context, req *computepb. baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_instance_group_managers_client.go b/compute/apiv1/region_instance_group_managers_client.go index 4e108c40cd9..519364c07f1 100644 --- a/compute/apiv1/region_instance_group_managers_client.go +++ b/compute/apiv1/region_instance_group_managers_client.go @@ -265,8 +265,8 @@ func NewRegionInstanceGroupManagersRESTClient(ctx context.Context, opts ...optio func defaultRegionInstanceGroupManagersRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -448,12 +448,6 @@ func (c *regionInstanceGroupManagersRESTClient) CreateInstances(ctx context.Cont // Delete deletes the specified managed instance group and all of the instances in that group. func (c *regionInstanceGroupManagersRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) @@ -464,7 +458,7 @@ func (c *regionInstanceGroupManagersRESTClient) Delete(ctx context.Context, req baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -597,16 +591,10 @@ func (c *regionInstanceGroupManagersRESTClient) DeletePerInstanceConfigs(ctx con // Get returns all of the details about the specified managed instance group. func (c *regionInstanceGroupManagersRESTClient) Get(ctx context.Context, req *computepb.GetRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.InstanceGroupManager, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -693,12 +681,6 @@ func (c *regionInstanceGroupManagersRESTClient) Insert(ctx context.Context, req // List retrieves the list of managed instance groups that are contained within the specified region. func (c *regionInstanceGroupManagersRESTClient) List(ctx context.Context, req *computepb.ListRegionInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupManagerList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers", req.GetProject(), req.GetRegion()) @@ -721,7 +703,7 @@ func (c *regionInstanceGroupManagersRESTClient) List(ctx context.Context, req *c baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -755,12 +737,6 @@ func (c *regionInstanceGroupManagersRESTClient) List(ctx context.Context, req *c // ListErrors lists all errors thrown by actions on instances for a given regional managed instance group. The filter and orderBy query parameters are not supported. func (c *regionInstanceGroupManagersRESTClient) ListErrors(ctx context.Context, req *computepb.ListErrorsRegionInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupManagersListErrorsResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/listErrors", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) @@ -783,7 +759,7 @@ func (c *regionInstanceGroupManagersRESTClient) ListErrors(ctx context.Context, baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -817,12 +793,6 @@ func (c *regionInstanceGroupManagersRESTClient) ListErrors(ctx context.Context, // ListManagedInstances lists the instances in the managed instance group and instances that are scheduled to be created. The list includes any current actions that the group has scheduled for its instances. The orderBy query parameter is not supported. func (c *regionInstanceGroupManagersRESTClient) ListManagedInstances(ctx context.Context, req *computepb.ListManagedInstancesRegionInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupManagersListInstancesResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/listManagedInstances", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) @@ -845,7 +815,7 @@ func (c *regionInstanceGroupManagersRESTClient) ListManagedInstances(ctx context baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -879,12 +849,6 @@ func (c *regionInstanceGroupManagersRESTClient) ListManagedInstances(ctx context // ListPerInstanceConfigs lists all of the per-instance configs defined for the managed instance group. The orderBy query parameter is not supported. func (c *regionInstanceGroupManagersRESTClient) ListPerInstanceConfigs(ctx context.Context, req *computepb.ListPerInstanceConfigsRegionInstanceGroupManagersRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupManagersListInstanceConfigsResp, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/listPerInstanceConfigs", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) @@ -907,7 +871,7 @@ func (c *regionInstanceGroupManagersRESTClient) ListPerInstanceConfigs(ctx conte baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } @@ -1102,12 +1066,6 @@ func (c *regionInstanceGroupManagersRESTClient) RecreateInstances(ctx context.Co // // If the group is part of a backend service that has enabled connection draining, it can take up to 60 seconds after the connection draining duration has elapsed before the VM instance is removed or deleted. func (c *regionInstanceGroupManagersRESTClient) Resize(ctx context.Context, req *computepb.ResizeRegionInstanceGroupManagerRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroupManagers/%v/resize", req.GetProject(), req.GetRegion(), req.GetInstanceGroupManager()) @@ -1121,7 +1079,7 @@ func (c *regionInstanceGroupManagersRESTClient) Resize(ctx context.Context, req baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_instance_groups_client.go b/compute/apiv1/region_instance_groups_client.go index d2698ffb112..61dcec0064d 100644 --- a/compute/apiv1/region_instance_groups_client.go +++ b/compute/apiv1/region_instance_groups_client.go @@ -142,8 +142,8 @@ func NewRegionInstanceGroupsRESTClient(ctx context.Context, opts ...option.Clien func defaultRegionInstanceGroupsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -175,16 +175,10 @@ func (c *regionInstanceGroupsRESTClient) Connection() *grpc.ClientConn { // Get returns the specified instance group resource. func (c *regionInstanceGroupsRESTClient) Get(ctx context.Context, req *computepb.GetRegionInstanceGroupRequest, opts ...gax.CallOption) (*computepb.InstanceGroup, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroups/%v", req.GetProject(), req.GetRegion(), req.GetInstanceGroup()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -218,12 +212,6 @@ func (c *regionInstanceGroupsRESTClient) Get(ctx context.Context, req *computepb // List retrieves the list of instance group resources contained within the specified region. func (c *regionInstanceGroupsRESTClient) List(ctx context.Context, req *computepb.ListRegionInstanceGroupsRequest, opts ...gax.CallOption) (*computepb.RegionInstanceGroupList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/instanceGroups", req.GetProject(), req.GetRegion()) @@ -246,7 +234,7 @@ func (c *regionInstanceGroupsRESTClient) List(ctx context.Context, req *computep baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_instances_client.go b/compute/apiv1/region_instances_client.go index e9a7f88fdf8..fc255a0f815 100644 --- a/compute/apiv1/region_instances_client.go +++ b/compute/apiv1/region_instances_client.go @@ -121,8 +121,8 @@ func NewRegionInstancesRESTClient(ctx context.Context, opts ...option.ClientOpti func defaultRegionInstancesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } diff --git a/compute/apiv1/region_network_endpoint_groups_client.go b/compute/apiv1/region_network_endpoint_groups_client.go index ace6be51de1..941248cc8a9 100644 --- a/compute/apiv1/region_network_endpoint_groups_client.go +++ b/compute/apiv1/region_network_endpoint_groups_client.go @@ -142,8 +142,8 @@ func NewRegionNetworkEndpointGroupsRESTClient(ctx context.Context, opts ...optio func defaultRegionNetworkEndpointGroupsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -175,12 +175,6 @@ func (c *regionNetworkEndpointGroupsRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified network endpoint group. Note that the NEG cannot be deleted if it is configured as a backend of a backend service. func (c *regionNetworkEndpointGroupsRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/networkEndpointGroups/%v", req.GetProject(), req.GetRegion(), req.GetNetworkEndpointGroup()) @@ -191,7 +185,7 @@ func (c *regionNetworkEndpointGroupsRESTClient) Delete(ctx context.Context, req baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -225,16 +219,10 @@ func (c *regionNetworkEndpointGroupsRESTClient) Delete(ctx context.Context, req // Get returns the specified network endpoint group. Gets a list of available network endpoint groups by making a list() request. func (c *regionNetworkEndpointGroupsRESTClient) Get(ctx context.Context, req *computepb.GetRegionNetworkEndpointGroupRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroup, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/networkEndpointGroups/%v", req.GetProject(), req.GetRegion(), req.GetNetworkEndpointGroup()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -319,12 +307,6 @@ func (c *regionNetworkEndpointGroupsRESTClient) Insert(ctx context.Context, req // List retrieves the list of regional network endpoint groups available to the specified project in the given region. func (c *regionNetworkEndpointGroupsRESTClient) List(ctx context.Context, req *computepb.ListRegionNetworkEndpointGroupsRequest, opts ...gax.CallOption) (*computepb.NetworkEndpointGroupList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/networkEndpointGroups", req.GetProject(), req.GetRegion()) @@ -347,7 +329,7 @@ func (c *regionNetworkEndpointGroupsRESTClient) List(ctx context.Context, req *c baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_notification_endpoints_client.go b/compute/apiv1/region_notification_endpoints_client.go index 1ab16484260..cd77148d7d8 100644 --- a/compute/apiv1/region_notification_endpoints_client.go +++ b/compute/apiv1/region_notification_endpoints_client.go @@ -142,8 +142,8 @@ func NewRegionNotificationEndpointsRESTClient(ctx context.Context, opts ...optio func defaultRegionNotificationEndpointsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -175,12 +175,6 @@ func (c *regionNotificationEndpointsRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified NotificationEndpoint in the given region func (c *regionNotificationEndpointsRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionNotificationEndpointRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/notificationEndpoints/%v", req.GetProject(), req.GetRegion(), req.GetNotificationEndpoint()) @@ -191,7 +185,7 @@ func (c *regionNotificationEndpointsRESTClient) Delete(ctx context.Context, req baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -225,16 +219,10 @@ func (c *regionNotificationEndpointsRESTClient) Delete(ctx context.Context, req // Get returns the specified NotificationEndpoint resource in the given region. func (c *regionNotificationEndpointsRESTClient) Get(ctx context.Context, req *computepb.GetRegionNotificationEndpointRequest, opts ...gax.CallOption) (*computepb.NotificationEndpoint, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/notificationEndpoints/%v", req.GetProject(), req.GetRegion(), req.GetNotificationEndpoint()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -319,12 +307,6 @@ func (c *regionNotificationEndpointsRESTClient) Insert(ctx context.Context, req // List lists the NotificationEndpoints for a project in the given region. func (c *regionNotificationEndpointsRESTClient) List(ctx context.Context, req *computepb.ListRegionNotificationEndpointsRequest, opts ...gax.CallOption) (*computepb.NotificationEndpointList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/notificationEndpoints", req.GetProject(), req.GetRegion()) @@ -347,7 +329,7 @@ func (c *regionNotificationEndpointsRESTClient) List(ctx context.Context, req *c baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_operations_client.go b/compute/apiv1/region_operations_client.go index cccff7a0508..f24dca1df36 100644 --- a/compute/apiv1/region_operations_client.go +++ b/compute/apiv1/region_operations_client.go @@ -17,7 +17,6 @@ package compute import ( - "bytes" "context" "fmt" "io/ioutil" @@ -148,8 +147,8 @@ func NewRegionOperationsRESTClient(ctx context.Context, opts ...option.ClientOpt func defaultRegionOperationsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -181,16 +180,10 @@ func (c *regionOperationsRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified region-specific Operations resource. func (c *regionOperationsRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionOperationRequest, opts ...gax.CallOption) (*computepb.DeleteRegionOperationResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/operations/%v", req.GetProject(), req.GetRegion(), req.GetOperation()) - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -224,16 +217,10 @@ func (c *regionOperationsRESTClient) Delete(ctx context.Context, req *computepb. // Get retrieves the specified region-specific Operations resource. func (c *regionOperationsRESTClient) Get(ctx context.Context, req *computepb.GetRegionOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/operations/%v", req.GetProject(), req.GetRegion(), req.GetOperation()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -267,12 +254,6 @@ func (c *regionOperationsRESTClient) Get(ctx context.Context, req *computepb.Get // List retrieves a list of Operation resources contained within the specified region. func (c *regionOperationsRESTClient) List(ctx context.Context, req *computepb.ListRegionOperationsRequest, opts ...gax.CallOption) (*computepb.OperationList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/operations", req.GetProject(), req.GetRegion()) @@ -295,7 +276,7 @@ func (c *regionOperationsRESTClient) List(ctx context.Context, req *computepb.Li baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -335,16 +316,10 @@ func (c *regionOperationsRESTClient) List(ctx context.Context, req *computepb.Li // // If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not DONE. func (c *regionOperationsRESTClient) Wait(ctx context.Context, req *computepb.WaitRegionOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/operations/%v/wait", req.GetProject(), req.GetRegion(), req.GetOperation()) - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_ssl_certificates_client.go b/compute/apiv1/region_ssl_certificates_client.go index bcf069420d6..d798901cd9c 100644 --- a/compute/apiv1/region_ssl_certificates_client.go +++ b/compute/apiv1/region_ssl_certificates_client.go @@ -142,8 +142,8 @@ func NewRegionSslCertificatesRESTClient(ctx context.Context, opts ...option.Clie func defaultRegionSslCertificatesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -175,12 +175,6 @@ func (c *regionSslCertificatesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified SslCertificate resource in the region. func (c *regionSslCertificatesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionSslCertificateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslCertificates/%v", req.GetProject(), req.GetRegion(), req.GetSslCertificate()) @@ -191,7 +185,7 @@ func (c *regionSslCertificatesRESTClient) Delete(ctx context.Context, req *compu baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -225,16 +219,10 @@ func (c *regionSslCertificatesRESTClient) Delete(ctx context.Context, req *compu // Get returns the specified SslCertificate resource in the specified region. Get a list of available SSL certificates by making a list() request. func (c *regionSslCertificatesRESTClient) Get(ctx context.Context, req *computepb.GetRegionSslCertificateRequest, opts ...gax.CallOption) (*computepb.SslCertificate, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslCertificates/%v", req.GetProject(), req.GetRegion(), req.GetSslCertificate()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -319,12 +307,6 @@ func (c *regionSslCertificatesRESTClient) Insert(ctx context.Context, req *compu // List retrieves the list of SslCertificate resources available to the specified project in the specified region. func (c *regionSslCertificatesRESTClient) List(ctx context.Context, req *computepb.ListRegionSslCertificatesRequest, opts ...gax.CallOption) (*computepb.SslCertificateList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/sslCertificates", req.GetProject(), req.GetRegion()) @@ -347,7 +329,7 @@ func (c *regionSslCertificatesRESTClient) List(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_target_http_proxies_client.go b/compute/apiv1/region_target_http_proxies_client.go index f2a338841e2..134c90b0110 100644 --- a/compute/apiv1/region_target_http_proxies_client.go +++ b/compute/apiv1/region_target_http_proxies_client.go @@ -149,8 +149,8 @@ func NewRegionTargetHttpProxiesRESTClient(ctx context.Context, opts ...option.Cl func defaultRegionTargetHttpProxiesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -182,12 +182,6 @@ func (c *regionTargetHttpProxiesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified TargetHttpProxy resource. func (c *regionTargetHttpProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpProxies/%v", req.GetProject(), req.GetRegion(), req.GetTargetHttpProxy()) @@ -198,7 +192,7 @@ func (c *regionTargetHttpProxiesRESTClient) Delete(ctx context.Context, req *com baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -232,16 +226,10 @@ func (c *regionTargetHttpProxiesRESTClient) Delete(ctx context.Context, req *com // Get returns the specified TargetHttpProxy resource in the specified region. Gets a list of available target HTTP proxies by making a list() request. func (c *regionTargetHttpProxiesRESTClient) Get(ctx context.Context, req *computepb.GetRegionTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpProxies/%v", req.GetProject(), req.GetRegion(), req.GetTargetHttpProxy()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -326,12 +314,6 @@ func (c *regionTargetHttpProxiesRESTClient) Insert(ctx context.Context, req *com // List retrieves the list of TargetHttpProxy resources available to the specified project in the specified region. func (c *regionTargetHttpProxiesRESTClient) List(ctx context.Context, req *computepb.ListRegionTargetHttpProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxyList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpProxies", req.GetProject(), req.GetRegion()) @@ -354,7 +336,7 @@ func (c *regionTargetHttpProxiesRESTClient) List(ctx context.Context, req *compu baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_target_https_proxies_client.go b/compute/apiv1/region_target_https_proxies_client.go index af6c5481aa6..9c8860b222b 100644 --- a/compute/apiv1/region_target_https_proxies_client.go +++ b/compute/apiv1/region_target_https_proxies_client.go @@ -156,8 +156,8 @@ func NewRegionTargetHttpsProxiesRESTClient(ctx context.Context, opts ...option.C func defaultRegionTargetHttpsProxiesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -189,12 +189,6 @@ func (c *regionTargetHttpsProxiesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified TargetHttpsProxy resource. func (c *regionTargetHttpsProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpsProxies/%v", req.GetProject(), req.GetRegion(), req.GetTargetHttpsProxy()) @@ -205,7 +199,7 @@ func (c *regionTargetHttpsProxiesRESTClient) Delete(ctx context.Context, req *co baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -239,16 +233,10 @@ func (c *regionTargetHttpsProxiesRESTClient) Delete(ctx context.Context, req *co // Get returns the specified TargetHttpsProxy resource in the specified region. Gets a list of available target HTTP proxies by making a list() request. func (c *regionTargetHttpsProxiesRESTClient) Get(ctx context.Context, req *computepb.GetRegionTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpsProxies/%v", req.GetProject(), req.GetRegion(), req.GetTargetHttpsProxy()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -333,12 +321,6 @@ func (c *regionTargetHttpsProxiesRESTClient) Insert(ctx context.Context, req *co // List retrieves the list of TargetHttpsProxy resources available to the specified project in the specified region. func (c *regionTargetHttpsProxiesRESTClient) List(ctx context.Context, req *computepb.ListRegionTargetHttpsProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxyList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetHttpsProxies", req.GetProject(), req.GetRegion()) @@ -361,7 +343,7 @@ func (c *regionTargetHttpsProxiesRESTClient) List(ctx context.Context, req *comp baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/region_url_maps_client.go b/compute/apiv1/region_url_maps_client.go index 732c9c082d2..88c17147246 100644 --- a/compute/apiv1/region_url_maps_client.go +++ b/compute/apiv1/region_url_maps_client.go @@ -163,8 +163,8 @@ func NewRegionUrlMapsRESTClient(ctx context.Context, opts ...option.ClientOption func defaultRegionUrlMapsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -196,12 +196,6 @@ func (c *regionUrlMapsRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified UrlMap resource. func (c *regionUrlMapsRESTClient) Delete(ctx context.Context, req *computepb.DeleteRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps/%v", req.GetProject(), req.GetRegion(), req.GetUrlMap()) @@ -212,7 +206,7 @@ func (c *regionUrlMapsRESTClient) Delete(ctx context.Context, req *computepb.Del baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -246,16 +240,10 @@ func (c *regionUrlMapsRESTClient) Delete(ctx context.Context, req *computepb.Del // Get returns the specified UrlMap resource. Gets a list of available URL maps by making a list() request. func (c *regionUrlMapsRESTClient) Get(ctx context.Context, req *computepb.GetRegionUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMap, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps/%v", req.GetProject(), req.GetRegion(), req.GetUrlMap()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -340,12 +328,6 @@ func (c *regionUrlMapsRESTClient) Insert(ctx context.Context, req *computepb.Ins // List retrieves the list of UrlMap resources available to the specified project in the specified region. func (c *regionUrlMapsRESTClient) List(ctx context.Context, req *computepb.ListRegionUrlMapsRequest, opts ...gax.CallOption) (*computepb.UrlMapList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/urlMaps", req.GetProject(), req.GetRegion()) @@ -368,7 +350,7 @@ func (c *regionUrlMapsRESTClient) List(ctx context.Context, req *computepb.ListR baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/regions_client.go b/compute/apiv1/regions_client.go index 9d26c40564b..ed40dc247c9 100644 --- a/compute/apiv1/regions_client.go +++ b/compute/apiv1/regions_client.go @@ -17,7 +17,6 @@ package compute import ( - "bytes" "context" "fmt" "io/ioutil" @@ -128,8 +127,8 @@ func NewRegionsRESTClient(ctx context.Context, opts ...option.ClientOption) (*Re func defaultRegionsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -161,16 +160,10 @@ func (c *regionsRESTClient) Connection() *grpc.ClientConn { // Get returns the specified Region resource. Gets a list of available regions by making a list() request. func (c *regionsRESTClient) Get(ctx context.Context, req *computepb.GetRegionRequest, opts ...gax.CallOption) (*computepb.Region, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v", req.GetProject(), req.GetRegion()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -204,12 +197,6 @@ func (c *regionsRESTClient) Get(ctx context.Context, req *computepb.GetRegionReq // List retrieves the list of region resources available to the specified project. func (c *regionsRESTClient) List(ctx context.Context, req *computepb.ListRegionsRequest, opts ...gax.CallOption) (*computepb.RegionList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions", req.GetProject()) @@ -232,7 +219,7 @@ func (c *regionsRESTClient) List(ctx context.Context, req *computepb.ListRegions baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/reservations_client.go b/compute/apiv1/reservations_client.go index 9c3cd718cce..207de1cbc42 100644 --- a/compute/apiv1/reservations_client.go +++ b/compute/apiv1/reservations_client.go @@ -177,8 +177,8 @@ func NewReservationsRESTClient(ctx context.Context, opts ...option.ClientOption) func defaultReservationsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -210,12 +210,6 @@ func (c *reservationsRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of reservations. func (c *reservationsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListReservationsRequest, opts ...gax.CallOption) (*computepb.ReservationAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/reservations", req.GetProject()) @@ -241,7 +235,7 @@ func (c *reservationsRESTClient) AggregatedList(ctx context.Context, req *comput baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -275,12 +269,6 @@ func (c *reservationsRESTClient) AggregatedList(ctx context.Context, req *comput // Delete deletes the specified reservation. func (c *reservationsRESTClient) Delete(ctx context.Context, req *computepb.DeleteReservationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/reservations/%v", req.GetProject(), req.GetZone(), req.GetReservation()) @@ -291,7 +279,7 @@ func (c *reservationsRESTClient) Delete(ctx context.Context, req *computepb.Dele baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -325,16 +313,10 @@ func (c *reservationsRESTClient) Delete(ctx context.Context, req *computepb.Dele // Get retrieves information about the specified reservation. func (c *reservationsRESTClient) Get(ctx context.Context, req *computepb.GetReservationRequest, opts ...gax.CallOption) (*computepb.Reservation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/reservations/%v", req.GetProject(), req.GetZone(), req.GetReservation()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -368,12 +350,6 @@ func (c *reservationsRESTClient) Get(ctx context.Context, req *computepb.GetRese // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. func (c *reservationsRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyReservationRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/reservations/%v/getIamPolicy", req.GetProject(), req.GetZone(), req.GetResource()) @@ -384,7 +360,7 @@ func (c *reservationsRESTClient) GetIamPolicy(ctx context.Context, req *computep baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -469,12 +445,6 @@ func (c *reservationsRESTClient) Insert(ctx context.Context, req *computepb.Inse // List a list of all the reservations that have been configured for the specified project in specified zone. func (c *reservationsRESTClient) List(ctx context.Context, req *computepb.ListReservationsRequest, opts ...gax.CallOption) (*computepb.ReservationList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/reservations", req.GetProject(), req.GetZone()) @@ -497,7 +467,7 @@ func (c *reservationsRESTClient) List(ctx context.Context, req *computepb.ListRe baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/resource_policies_client.go b/compute/apiv1/resource_policies_client.go index 4e2b4d86273..768a7798c49 100644 --- a/compute/apiv1/resource_policies_client.go +++ b/compute/apiv1/resource_policies_client.go @@ -170,8 +170,8 @@ func NewResourcePoliciesRESTClient(ctx context.Context, opts ...option.ClientOpt func defaultResourcePoliciesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -203,12 +203,6 @@ func (c *resourcePoliciesRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of resource policies. func (c *resourcePoliciesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListResourcePoliciesRequest, opts ...gax.CallOption) (*computepb.ResourcePolicyAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/resourcePolicies", req.GetProject()) @@ -234,7 +228,7 @@ func (c *resourcePoliciesRESTClient) AggregatedList(ctx context.Context, req *co baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -268,12 +262,6 @@ func (c *resourcePoliciesRESTClient) AggregatedList(ctx context.Context, req *co // Delete deletes the specified resource policy. func (c *resourcePoliciesRESTClient) Delete(ctx context.Context, req *computepb.DeleteResourcePolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/resourcePolicies/%v", req.GetProject(), req.GetRegion(), req.GetResourcePolicy()) @@ -284,7 +272,7 @@ func (c *resourcePoliciesRESTClient) Delete(ctx context.Context, req *computepb. baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -318,16 +306,10 @@ func (c *resourcePoliciesRESTClient) Delete(ctx context.Context, req *computepb. // Get retrieves all information of the specified resource policy. func (c *resourcePoliciesRESTClient) Get(ctx context.Context, req *computepb.GetResourcePolicyRequest, opts ...gax.CallOption) (*computepb.ResourcePolicy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/resourcePolicies/%v", req.GetProject(), req.GetRegion(), req.GetResourcePolicy()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -361,12 +343,6 @@ func (c *resourcePoliciesRESTClient) Get(ctx context.Context, req *computepb.Get // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. func (c *resourcePoliciesRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicyResourcePolicyRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/resourcePolicies/%v/getIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource()) @@ -377,7 +353,7 @@ func (c *resourcePoliciesRESTClient) GetIamPolicy(ctx context.Context, req *comp baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -462,12 +438,6 @@ func (c *resourcePoliciesRESTClient) Insert(ctx context.Context, req *computepb. // List a list all the resource policies that have been configured for the specified project in specified region. func (c *resourcePoliciesRESTClient) List(ctx context.Context, req *computepb.ListResourcePoliciesRequest, opts ...gax.CallOption) (*computepb.ResourcePolicyList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/resourcePolicies", req.GetProject(), req.GetRegion()) @@ -490,7 +460,7 @@ func (c *resourcePoliciesRESTClient) List(ctx context.Context, req *computepb.Li baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/routers_client.go b/compute/apiv1/routers_client.go index b454d1707d6..c7e74b47203 100644 --- a/compute/apiv1/routers_client.go +++ b/compute/apiv1/routers_client.go @@ -184,8 +184,8 @@ func NewRoutersRESTClient(ctx context.Context, opts ...option.ClientOption) (*Ro func defaultRoutersRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -217,12 +217,6 @@ func (c *routersRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of routers. func (c *routersRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListRoutersRequest, opts ...gax.CallOption) (*computepb.RouterAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/routers", req.GetProject()) @@ -248,7 +242,7 @@ func (c *routersRESTClient) AggregatedList(ctx context.Context, req *computepb.A baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -282,12 +276,6 @@ func (c *routersRESTClient) AggregatedList(ctx context.Context, req *computepb.A // Delete deletes the specified Router resource. func (c *routersRESTClient) Delete(ctx context.Context, req *computepb.DeleteRouterRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers/%v", req.GetProject(), req.GetRegion(), req.GetRouter()) @@ -298,7 +286,7 @@ func (c *routersRESTClient) Delete(ctx context.Context, req *computepb.DeleteRou baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -332,16 +320,10 @@ func (c *routersRESTClient) Delete(ctx context.Context, req *computepb.DeleteRou // Get returns the specified Router resource. Gets a list of available routers by making a list() request. func (c *routersRESTClient) Get(ctx context.Context, req *computepb.GetRouterRequest, opts ...gax.CallOption) (*computepb.Router, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers/%v", req.GetProject(), req.GetRegion(), req.GetRouter()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -375,12 +357,6 @@ func (c *routersRESTClient) Get(ctx context.Context, req *computepb.GetRouterReq // GetNatMappingInfo retrieves runtime Nat mapping information of VM endpoints. func (c *routersRESTClient) GetNatMappingInfo(ctx context.Context, req *computepb.GetNatMappingInfoRoutersRequest, opts ...gax.CallOption) (*computepb.VmEndpointNatMappingsList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers/%v/getNatMappingInfo", req.GetProject(), req.GetRegion(), req.GetRouter()) @@ -403,7 +379,7 @@ func (c *routersRESTClient) GetNatMappingInfo(ctx context.Context, req *computep baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -437,16 +413,10 @@ func (c *routersRESTClient) GetNatMappingInfo(ctx context.Context, req *computep // GetRouterStatus retrieves runtime information of the specified router. func (c *routersRESTClient) GetRouterStatus(ctx context.Context, req *computepb.GetRouterStatusRouterRequest, opts ...gax.CallOption) (*computepb.RouterStatusResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers/%v/getRouterStatus", req.GetProject(), req.GetRegion(), req.GetRouter()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -531,12 +501,6 @@ func (c *routersRESTClient) Insert(ctx context.Context, req *computepb.InsertRou // List retrieves a list of Router resources available to the specified project. func (c *routersRESTClient) List(ctx context.Context, req *computepb.ListRoutersRequest, opts ...gax.CallOption) (*computepb.RouterList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/routers", req.GetProject(), req.GetRegion()) @@ -559,7 +523,7 @@ func (c *routersRESTClient) List(ctx context.Context, req *computepb.ListRouters baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/routes_client.go b/compute/apiv1/routes_client.go index cd8f909f21b..af6d9a2e86b 100644 --- a/compute/apiv1/routes_client.go +++ b/compute/apiv1/routes_client.go @@ -142,8 +142,8 @@ func NewRoutesRESTClient(ctx context.Context, opts ...option.ClientOption) (*Rou func defaultRoutesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -175,12 +175,6 @@ func (c *routesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified Route resource. func (c *routesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRouteRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/routes/%v", req.GetProject(), req.GetRoute()) @@ -191,7 +185,7 @@ func (c *routesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRout baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -225,16 +219,10 @@ func (c *routesRESTClient) Delete(ctx context.Context, req *computepb.DeleteRout // Get returns the specified Route resource. Gets a list of available routes by making a list() request. func (c *routesRESTClient) Get(ctx context.Context, req *computepb.GetRouteRequest, opts ...gax.CallOption) (*computepb.Route, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/routes/%v", req.GetProject(), req.GetRoute()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -319,12 +307,6 @@ func (c *routesRESTClient) Insert(ctx context.Context, req *computepb.InsertRout // List retrieves the list of Route resources available to the specified project. func (c *routesRESTClient) List(ctx context.Context, req *computepb.ListRoutesRequest, opts ...gax.CallOption) (*computepb.RouteList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/routes", req.GetProject()) @@ -347,7 +329,7 @@ func (c *routesRESTClient) List(ctx context.Context, req *computepb.ListRoutesRe baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/security_policies_client.go b/compute/apiv1/security_policies_client.go index fceb1652547..409d6c5041c 100644 --- a/compute/apiv1/security_policies_client.go +++ b/compute/apiv1/security_policies_client.go @@ -184,8 +184,8 @@ func NewSecurityPoliciesRESTClient(ctx context.Context, opts ...option.ClientOpt func defaultSecurityPoliciesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -261,12 +261,6 @@ func (c *securityPoliciesRESTClient) AddRule(ctx context.Context, req *computepb // Delete deletes the specified policy. func (c *securityPoliciesRESTClient) Delete(ctx context.Context, req *computepb.DeleteSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/%v", req.GetProject(), req.GetSecurityPolicy()) @@ -277,7 +271,7 @@ func (c *securityPoliciesRESTClient) Delete(ctx context.Context, req *computepb. baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -311,16 +305,10 @@ func (c *securityPoliciesRESTClient) Delete(ctx context.Context, req *computepb. // Get list all of the ordered rules present in a single specified policy. func (c *securityPoliciesRESTClient) Get(ctx context.Context, req *computepb.GetSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.SecurityPolicy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/%v", req.GetProject(), req.GetSecurityPolicy()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -354,12 +342,6 @@ func (c *securityPoliciesRESTClient) Get(ctx context.Context, req *computepb.Get // GetRule gets a rule at the specified priority. func (c *securityPoliciesRESTClient) GetRule(ctx context.Context, req *computepb.GetRuleSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.SecurityPolicyRule, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/%v/getRule", req.GetProject(), req.GetSecurityPolicy()) @@ -370,7 +352,7 @@ func (c *securityPoliciesRESTClient) GetRule(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -455,12 +437,6 @@ func (c *securityPoliciesRESTClient) Insert(ctx context.Context, req *computepb. // List list all the policies that have been configured for the specified project. func (c *securityPoliciesRESTClient) List(ctx context.Context, req *computepb.ListSecurityPoliciesRequest, opts ...gax.CallOption) (*computepb.SecurityPolicyList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies", req.GetProject()) @@ -483,7 +459,7 @@ func (c *securityPoliciesRESTClient) List(ctx context.Context, req *computepb.Li baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -517,12 +493,6 @@ func (c *securityPoliciesRESTClient) List(ctx context.Context, req *computepb.Li // ListPreconfiguredExpressionSets gets the current list of preconfigured Web Application Firewall (WAF) expressions. func (c *securityPoliciesRESTClient) ListPreconfiguredExpressionSets(ctx context.Context, req *computepb.ListPreconfiguredExpressionSetsSecurityPoliciesRequest, opts ...gax.CallOption) (*computepb.SecurityPoliciesListPreconfiguredExpressionSetsResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/listPreconfiguredExpressionSets", req.GetProject()) @@ -545,7 +515,7 @@ func (c *securityPoliciesRESTClient) ListPreconfiguredExpressionSets(ctx context baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -681,12 +651,6 @@ func (c *securityPoliciesRESTClient) PatchRule(ctx context.Context, req *compute // RemoveRule deletes a rule at the specified priority. func (c *securityPoliciesRESTClient) RemoveRule(ctx context.Context, req *computepb.RemoveRuleSecurityPolicyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/securityPolicies/%v/removeRule", req.GetProject(), req.GetSecurityPolicy()) @@ -697,7 +661,7 @@ func (c *securityPoliciesRESTClient) RemoveRule(ctx context.Context, req *comput baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/snapshots_client.go b/compute/apiv1/snapshots_client.go index d95bf38a6f8..b8e887db47d 100644 --- a/compute/apiv1/snapshots_client.go +++ b/compute/apiv1/snapshots_client.go @@ -165,8 +165,8 @@ func NewSnapshotsRESTClient(ctx context.Context, opts ...option.ClientOption) (* func defaultSnapshotsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -200,12 +200,6 @@ func (c *snapshotsRESTClient) Connection() *grpc.ClientConn { // // For more information, see Deleting snapshots. func (c *snapshotsRESTClient) Delete(ctx context.Context, req *computepb.DeleteSnapshotRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/snapshots/%v", req.GetProject(), req.GetSnapshot()) @@ -216,7 +210,7 @@ func (c *snapshotsRESTClient) Delete(ctx context.Context, req *computepb.DeleteS baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -250,16 +244,10 @@ func (c *snapshotsRESTClient) Delete(ctx context.Context, req *computepb.DeleteS // Get returns the specified Snapshot resource. Gets a list of available snapshots by making a list() request. func (c *snapshotsRESTClient) Get(ctx context.Context, req *computepb.GetSnapshotRequest, opts ...gax.CallOption) (*computepb.Snapshot, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/snapshots/%v", req.GetProject(), req.GetSnapshot()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -293,12 +281,6 @@ func (c *snapshotsRESTClient) Get(ctx context.Context, req *computepb.GetSnapsho // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. func (c *snapshotsRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicySnapshotRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/snapshots/%v/getIamPolicy", req.GetProject(), req.GetResource()) @@ -309,7 +291,7 @@ func (c *snapshotsRESTClient) GetIamPolicy(ctx context.Context, req *computepb.G baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -343,12 +325,6 @@ func (c *snapshotsRESTClient) GetIamPolicy(ctx context.Context, req *computepb.G // List retrieves the list of Snapshot resources contained within the specified project. func (c *snapshotsRESTClient) List(ctx context.Context, req *computepb.ListSnapshotsRequest, opts ...gax.CallOption) (*computepb.SnapshotList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/snapshots", req.GetProject()) @@ -371,7 +347,7 @@ func (c *snapshotsRESTClient) List(ctx context.Context, req *computepb.ListSnaps baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/ssl_certificates_client.go b/compute/apiv1/ssl_certificates_client.go index 509741ea1e8..e69c65ec1c6 100644 --- a/compute/apiv1/ssl_certificates_client.go +++ b/compute/apiv1/ssl_certificates_client.go @@ -149,8 +149,8 @@ func NewSslCertificatesRESTClient(ctx context.Context, opts ...option.ClientOpti func defaultSslCertificatesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -182,12 +182,6 @@ func (c *sslCertificatesRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves the list of all SslCertificate resources, regional and global, available to the specified project. func (c *sslCertificatesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListSslCertificatesRequest, opts ...gax.CallOption) (*computepb.SslCertificateAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/sslCertificates", req.GetProject()) @@ -213,7 +207,7 @@ func (c *sslCertificatesRESTClient) AggregatedList(ctx context.Context, req *com baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -247,12 +241,6 @@ func (c *sslCertificatesRESTClient) AggregatedList(ctx context.Context, req *com // Delete deletes the specified SslCertificate resource. func (c *sslCertificatesRESTClient) Delete(ctx context.Context, req *computepb.DeleteSslCertificateRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslCertificates/%v", req.GetProject(), req.GetSslCertificate()) @@ -263,7 +251,7 @@ func (c *sslCertificatesRESTClient) Delete(ctx context.Context, req *computepb.D baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -297,16 +285,10 @@ func (c *sslCertificatesRESTClient) Delete(ctx context.Context, req *computepb.D // Get returns the specified SslCertificate resource. Gets a list of available SSL certificates by making a list() request. func (c *sslCertificatesRESTClient) Get(ctx context.Context, req *computepb.GetSslCertificateRequest, opts ...gax.CallOption) (*computepb.SslCertificate, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslCertificates/%v", req.GetProject(), req.GetSslCertificate()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -391,12 +373,6 @@ func (c *sslCertificatesRESTClient) Insert(ctx context.Context, req *computepb.I // List retrieves the list of SslCertificate resources available to the specified project. func (c *sslCertificatesRESTClient) List(ctx context.Context, req *computepb.ListSslCertificatesRequest, opts ...gax.CallOption) (*computepb.SslCertificateList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslCertificates", req.GetProject()) @@ -419,7 +395,7 @@ func (c *sslCertificatesRESTClient) List(ctx context.Context, req *computepb.Lis baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/ssl_policies_client.go b/compute/apiv1/ssl_policies_client.go index b3ead7c8b80..1ec92b7b3da 100644 --- a/compute/apiv1/ssl_policies_client.go +++ b/compute/apiv1/ssl_policies_client.go @@ -156,8 +156,8 @@ func NewSslPoliciesRESTClient(ctx context.Context, opts ...option.ClientOption) func defaultSslPoliciesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -189,12 +189,6 @@ func (c *sslPoliciesRESTClient) Connection() *grpc.ClientConn { // 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) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslPolicies/%v", req.GetProject(), req.GetSslPolicy()) @@ -205,7 +199,7 @@ func (c *sslPoliciesRESTClient) Delete(ctx context.Context, req *computepb.Delet baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -239,16 +233,10 @@ func (c *sslPoliciesRESTClient) Delete(ctx context.Context, req *computepb.Delet // Get lists all of the ordered rules present in a single specified policy. func (c *sslPoliciesRESTClient) Get(ctx context.Context, req *computepb.GetSslPolicyRequest, opts ...gax.CallOption) (*computepb.SslPolicy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslPolicies/%v", req.GetProject(), req.GetSslPolicy()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -333,12 +321,6 @@ func (c *sslPoliciesRESTClient) Insert(ctx context.Context, req *computepb.Inser // List lists all the SSL policies that have been configured for the specified project. func (c *sslPoliciesRESTClient) List(ctx context.Context, req *computepb.ListSslPoliciesRequest, opts ...gax.CallOption) (*computepb.SslPoliciesList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslPolicies", req.GetProject()) @@ -361,7 +343,7 @@ func (c *sslPoliciesRESTClient) List(ctx context.Context, req *computepb.ListSsl baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -395,12 +377,6 @@ func (c *sslPoliciesRESTClient) List(ctx context.Context, req *computepb.ListSsl // ListAvailableFeatures lists all features that can be specified in the SSL policy when using custom profile. func (c *sslPoliciesRESTClient) ListAvailableFeatures(ctx context.Context, req *computepb.ListAvailableFeaturesSslPoliciesRequest, opts ...gax.CallOption) (*computepb.SslPoliciesListAvailableFeaturesResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/sslPolicies/listAvailableFeatures", req.GetProject()) @@ -423,7 +399,7 @@ func (c *sslPoliciesRESTClient) ListAvailableFeatures(ctx context.Context, req * baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/subnetworks_client.go b/compute/apiv1/subnetworks_client.go index d0bcf696135..dad2da6f42b 100644 --- a/compute/apiv1/subnetworks_client.go +++ b/compute/apiv1/subnetworks_client.go @@ -198,8 +198,8 @@ func NewSubnetworksRESTClient(ctx context.Context, opts ...option.ClientOption) func defaultSubnetworksRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -231,12 +231,6 @@ func (c *subnetworksRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of subnetworks. func (c *subnetworksRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListSubnetworksRequest, opts ...gax.CallOption) (*computepb.SubnetworkAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/subnetworks", req.GetProject()) @@ -262,7 +256,7 @@ func (c *subnetworksRESTClient) AggregatedList(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -296,12 +290,6 @@ func (c *subnetworksRESTClient) AggregatedList(ctx context.Context, req *compute // Delete deletes the specified subnetwork. func (c *subnetworksRESTClient) Delete(ctx context.Context, req *computepb.DeleteSubnetworkRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks/%v", req.GetProject(), req.GetRegion(), req.GetSubnetwork()) @@ -312,7 +300,7 @@ func (c *subnetworksRESTClient) Delete(ctx context.Context, req *computepb.Delet baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -397,16 +385,10 @@ func (c *subnetworksRESTClient) ExpandIpCidrRange(ctx context.Context, req *comp // Get returns the specified subnetwork. Gets a list of available subnetworks list() request. func (c *subnetworksRESTClient) Get(ctx context.Context, req *computepb.GetSubnetworkRequest, opts ...gax.CallOption) (*computepb.Subnetwork, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks/%v", req.GetProject(), req.GetRegion(), req.GetSubnetwork()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -440,12 +422,6 @@ func (c *subnetworksRESTClient) Get(ctx context.Context, req *computepb.GetSubne // GetIamPolicy gets the access control policy for a resource. May be empty if no such policy or resource exists. func (c *subnetworksRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIamPolicySubnetworkRequest, opts ...gax.CallOption) (*computepb.Policy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks/%v/getIamPolicy", req.GetProject(), req.GetRegion(), req.GetResource()) @@ -456,7 +432,7 @@ func (c *subnetworksRESTClient) GetIamPolicy(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -541,12 +517,6 @@ func (c *subnetworksRESTClient) Insert(ctx context.Context, req *computepb.Inser // List retrieves a list of subnetworks available to the specified project. func (c *subnetworksRESTClient) List(ctx context.Context, req *computepb.ListSubnetworksRequest, opts ...gax.CallOption) (*computepb.SubnetworkList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/subnetworks", req.GetProject(), req.GetRegion()) @@ -569,7 +539,7 @@ func (c *subnetworksRESTClient) List(ctx context.Context, req *computepb.ListSub baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -603,12 +573,6 @@ func (c *subnetworksRESTClient) List(ctx context.Context, req *computepb.ListSub // ListUsable retrieves an aggregated list of all usable subnetworks in the project. func (c *subnetworksRESTClient) ListUsable(ctx context.Context, req *computepb.ListUsableSubnetworksRequest, opts ...gax.CallOption) (*computepb.UsableSubnetworksAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/subnetworks/listUsable", req.GetProject()) @@ -631,7 +595,7 @@ func (c *subnetworksRESTClient) ListUsable(ctx context.Context, req *computepb.L baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/target_grpc_proxies_client.go b/compute/apiv1/target_grpc_proxies_client.go index da17c2d17f9..54312245f16 100644 --- a/compute/apiv1/target_grpc_proxies_client.go +++ b/compute/apiv1/target_grpc_proxies_client.go @@ -149,8 +149,8 @@ func NewTargetGrpcProxiesRESTClient(ctx context.Context, opts ...option.ClientOp func defaultTargetGrpcProxiesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -182,12 +182,6 @@ func (c *targetGrpcProxiesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified TargetGrpcProxy in the given scope func (c *targetGrpcProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetGrpcProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetGrpcProxies/%v", req.GetProject(), req.GetTargetGrpcProxy()) @@ -198,7 +192,7 @@ func (c *targetGrpcProxiesRESTClient) Delete(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -232,16 +226,10 @@ func (c *targetGrpcProxiesRESTClient) Delete(ctx context.Context, req *computepb // Get returns the specified TargetGrpcProxy resource in the given scope. func (c *targetGrpcProxiesRESTClient) Get(ctx context.Context, req *computepb.GetTargetGrpcProxyRequest, opts ...gax.CallOption) (*computepb.TargetGrpcProxy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetGrpcProxies/%v", req.GetProject(), req.GetTargetGrpcProxy()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -326,12 +314,6 @@ func (c *targetGrpcProxiesRESTClient) Insert(ctx context.Context, req *computepb // List lists the TargetGrpcProxies for a project in the given scope. func (c *targetGrpcProxiesRESTClient) List(ctx context.Context, req *computepb.ListTargetGrpcProxiesRequest, opts ...gax.CallOption) (*computepb.TargetGrpcProxyList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetGrpcProxies", req.GetProject()) @@ -354,7 +336,7 @@ func (c *targetGrpcProxiesRESTClient) List(ctx context.Context, req *computepb.L baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/target_http_proxies_client.go b/compute/apiv1/target_http_proxies_client.go index a7dea19c74e..9db737cd336 100644 --- a/compute/apiv1/target_http_proxies_client.go +++ b/compute/apiv1/target_http_proxies_client.go @@ -163,8 +163,8 @@ func NewTargetHttpProxiesRESTClient(ctx context.Context, opts ...option.ClientOp func defaultTargetHttpProxiesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -196,12 +196,6 @@ func (c *targetHttpProxiesRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves the list of all TargetHttpProxy resources, regional and global, available to the specified project. func (c *targetHttpProxiesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetHttpProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxyAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/targetHttpProxies", req.GetProject()) @@ -227,7 +221,7 @@ func (c *targetHttpProxiesRESTClient) AggregatedList(ctx context.Context, req *c baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -261,12 +255,6 @@ func (c *targetHttpProxiesRESTClient) AggregatedList(ctx context.Context, req *c // Delete deletes the specified TargetHttpProxy resource. func (c *targetHttpProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpProxies/%v", req.GetProject(), req.GetTargetHttpProxy()) @@ -277,7 +265,7 @@ func (c *targetHttpProxiesRESTClient) Delete(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -311,16 +299,10 @@ func (c *targetHttpProxiesRESTClient) Delete(ctx context.Context, req *computepb // Get returns the specified TargetHttpProxy resource. Gets a list of available target HTTP proxies by making a list() request. func (c *targetHttpProxiesRESTClient) Get(ctx context.Context, req *computepb.GetTargetHttpProxyRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpProxies/%v", req.GetProject(), req.GetTargetHttpProxy()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -405,12 +387,6 @@ func (c *targetHttpProxiesRESTClient) Insert(ctx context.Context, req *computepb // List retrieves the list of TargetHttpProxy resources available to the specified project. func (c *targetHttpProxiesRESTClient) List(ctx context.Context, req *computepb.ListTargetHttpProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpProxyList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpProxies", req.GetProject()) @@ -433,7 +409,7 @@ func (c *targetHttpProxiesRESTClient) List(ctx context.Context, req *computepb.L baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/target_https_proxies_client.go b/compute/apiv1/target_https_proxies_client.go index c2af2689ab4..3fbd314906f 100644 --- a/compute/apiv1/target_https_proxies_client.go +++ b/compute/apiv1/target_https_proxies_client.go @@ -184,8 +184,8 @@ func NewTargetHttpsProxiesRESTClient(ctx context.Context, opts ...option.ClientO func defaultTargetHttpsProxiesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -217,12 +217,6 @@ func (c *targetHttpsProxiesRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves the list of all TargetHttpsProxy resources, regional and global, available to the specified project. func (c *targetHttpsProxiesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetHttpsProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxyAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/targetHttpsProxies", req.GetProject()) @@ -248,7 +242,7 @@ func (c *targetHttpsProxiesRESTClient) AggregatedList(ctx context.Context, req * baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -282,12 +276,6 @@ func (c *targetHttpsProxiesRESTClient) AggregatedList(ctx context.Context, req * // Delete deletes the specified TargetHttpsProxy resource. func (c *targetHttpsProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpsProxies/%v", req.GetProject(), req.GetTargetHttpsProxy()) @@ -298,7 +286,7 @@ func (c *targetHttpsProxiesRESTClient) Delete(ctx context.Context, req *computep baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -332,16 +320,10 @@ func (c *targetHttpsProxiesRESTClient) Delete(ctx context.Context, req *computep // Get returns the specified TargetHttpsProxy resource. Gets a list of available target HTTPS proxies by making a list() request. func (c *targetHttpsProxiesRESTClient) Get(ctx context.Context, req *computepb.GetTargetHttpsProxyRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpsProxies/%v", req.GetProject(), req.GetTargetHttpsProxy()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -426,12 +408,6 @@ func (c *targetHttpsProxiesRESTClient) Insert(ctx context.Context, req *computep // List retrieves the list of TargetHttpsProxy resources available to the specified project. func (c *targetHttpsProxiesRESTClient) List(ctx context.Context, req *computepb.ListTargetHttpsProxiesRequest, opts ...gax.CallOption) (*computepb.TargetHttpsProxyList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetHttpsProxies", req.GetProject()) @@ -454,7 +430,7 @@ func (c *targetHttpsProxiesRESTClient) List(ctx context.Context, req *computepb. baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/target_instances_client.go b/compute/apiv1/target_instances_client.go index 25b0514dc64..dd85caae634 100644 --- a/compute/apiv1/target_instances_client.go +++ b/compute/apiv1/target_instances_client.go @@ -149,8 +149,8 @@ func NewTargetInstancesRESTClient(ctx context.Context, opts ...option.ClientOpti func defaultTargetInstancesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -182,12 +182,6 @@ func (c *targetInstancesRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of target instances. func (c *targetInstancesRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetInstancesRequest, opts ...gax.CallOption) (*computepb.TargetInstanceAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/targetInstances", req.GetProject()) @@ -213,7 +207,7 @@ func (c *targetInstancesRESTClient) AggregatedList(ctx context.Context, req *com baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -247,12 +241,6 @@ func (c *targetInstancesRESTClient) AggregatedList(ctx context.Context, req *com // Delete deletes the specified TargetInstance resource. func (c *targetInstancesRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetInstanceRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/targetInstances/%v", req.GetProject(), req.GetZone(), req.GetTargetInstance()) @@ -263,7 +251,7 @@ func (c *targetInstancesRESTClient) Delete(ctx context.Context, req *computepb.D baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -297,16 +285,10 @@ func (c *targetInstancesRESTClient) Delete(ctx context.Context, req *computepb.D // Get returns the specified TargetInstance resource. Gets a list of available target instances by making a list() request. func (c *targetInstancesRESTClient) Get(ctx context.Context, req *computepb.GetTargetInstanceRequest, opts ...gax.CallOption) (*computepb.TargetInstance, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/targetInstances/%v", req.GetProject(), req.GetZone(), req.GetTargetInstance()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -391,12 +373,6 @@ func (c *targetInstancesRESTClient) Insert(ctx context.Context, req *computepb.I // List retrieves a list of TargetInstance resources available to the specified project and zone. func (c *targetInstancesRESTClient) List(ctx context.Context, req *computepb.ListTargetInstancesRequest, opts ...gax.CallOption) (*computepb.TargetInstanceList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/targetInstances", req.GetProject(), req.GetZone()) @@ -419,7 +395,7 @@ func (c *targetInstancesRESTClient) List(ctx context.Context, req *computepb.Lis baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/target_pools_client.go b/compute/apiv1/target_pools_client.go index f05abeca64d..0042a564b1b 100644 --- a/compute/apiv1/target_pools_client.go +++ b/compute/apiv1/target_pools_client.go @@ -191,8 +191,8 @@ func NewTargetPoolsRESTClient(ctx context.Context, opts ...option.ClientOption) func defaultTargetPoolsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -326,12 +326,6 @@ func (c *targetPoolsRESTClient) AddInstance(ctx context.Context, req *computepb. // AggregatedList retrieves an aggregated list of target pools. func (c *targetPoolsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetPoolsRequest, opts ...gax.CallOption) (*computepb.TargetPoolAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/targetPools", req.GetProject()) @@ -357,7 +351,7 @@ func (c *targetPoolsRESTClient) AggregatedList(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -391,12 +385,6 @@ func (c *targetPoolsRESTClient) AggregatedList(ctx context.Context, req *compute // Delete deletes the specified target pool. func (c *targetPoolsRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetPoolRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools/%v", req.GetProject(), req.GetRegion(), req.GetTargetPool()) @@ -407,7 +395,7 @@ func (c *targetPoolsRESTClient) Delete(ctx context.Context, req *computepb.Delet baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -441,16 +429,10 @@ func (c *targetPoolsRESTClient) Delete(ctx context.Context, req *computepb.Delet // Get returns the specified target pool. Gets a list of available target pools by making a list() request. func (c *targetPoolsRESTClient) Get(ctx context.Context, req *computepb.GetTargetPoolRequest, opts ...gax.CallOption) (*computepb.TargetPool, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools/%v", req.GetProject(), req.GetRegion(), req.GetTargetPool()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -579,12 +561,6 @@ func (c *targetPoolsRESTClient) Insert(ctx context.Context, req *computepb.Inser // List retrieves a list of target pools available to the specified project and region. func (c *targetPoolsRESTClient) List(ctx context.Context, req *computepb.ListTargetPoolsRequest, opts ...gax.CallOption) (*computepb.TargetPoolList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetPools", req.GetProject(), req.GetRegion()) @@ -607,7 +583,7 @@ func (c *targetPoolsRESTClient) List(ctx context.Context, req *computepb.ListTar baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/target_ssl_proxies_client.go b/compute/apiv1/target_ssl_proxies_client.go index bbbd9dc7364..e491275c4e2 100644 --- a/compute/apiv1/target_ssl_proxies_client.go +++ b/compute/apiv1/target_ssl_proxies_client.go @@ -170,8 +170,8 @@ func NewTargetSslProxiesRESTClient(ctx context.Context, opts ...option.ClientOpt func defaultTargetSslProxiesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -203,12 +203,6 @@ func (c *targetSslProxiesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified TargetSslProxy resource. func (c *targetSslProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetSslProxies/%v", req.GetProject(), req.GetTargetSslProxy()) @@ -219,7 +213,7 @@ func (c *targetSslProxiesRESTClient) Delete(ctx context.Context, req *computepb. baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -253,16 +247,10 @@ func (c *targetSslProxiesRESTClient) Delete(ctx context.Context, req *computepb. // Get returns the specified TargetSslProxy resource. Gets a list of available target SSL proxies by making a list() request. func (c *targetSslProxiesRESTClient) Get(ctx context.Context, req *computepb.GetTargetSslProxyRequest, opts ...gax.CallOption) (*computepb.TargetSslProxy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetSslProxies/%v", req.GetProject(), req.GetTargetSslProxy()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -347,12 +335,6 @@ func (c *targetSslProxiesRESTClient) Insert(ctx context.Context, req *computepb. // List retrieves the list of TargetSslProxy resources available to the specified project. func (c *targetSslProxiesRESTClient) List(ctx context.Context, req *computepb.ListTargetSslProxiesRequest, opts ...gax.CallOption) (*computepb.TargetSslProxyList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetSslProxies", req.GetProject()) @@ -375,7 +357,7 @@ func (c *targetSslProxiesRESTClient) List(ctx context.Context, req *computepb.Li baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/target_tcp_proxies_client.go b/compute/apiv1/target_tcp_proxies_client.go index f2631211628..37b83219c2f 100644 --- a/compute/apiv1/target_tcp_proxies_client.go +++ b/compute/apiv1/target_tcp_proxies_client.go @@ -156,8 +156,8 @@ func NewTargetTcpProxiesRESTClient(ctx context.Context, opts ...option.ClientOpt func defaultTargetTcpProxiesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -189,12 +189,6 @@ func (c *targetTcpProxiesRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified TargetTcpProxy resource. func (c *targetTcpProxiesRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetTcpProxies/%v", req.GetProject(), req.GetTargetTcpProxy()) @@ -205,7 +199,7 @@ func (c *targetTcpProxiesRESTClient) Delete(ctx context.Context, req *computepb. baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -239,16 +233,10 @@ func (c *targetTcpProxiesRESTClient) Delete(ctx context.Context, req *computepb. // Get returns the specified TargetTcpProxy resource. Gets a list of available target TCP proxies by making a list() request. func (c *targetTcpProxiesRESTClient) Get(ctx context.Context, req *computepb.GetTargetTcpProxyRequest, opts ...gax.CallOption) (*computepb.TargetTcpProxy, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetTcpProxies/%v", req.GetProject(), req.GetTargetTcpProxy()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -333,12 +321,6 @@ func (c *targetTcpProxiesRESTClient) Insert(ctx context.Context, req *computepb. // List retrieves the list of TargetTcpProxy resources available to the specified project. func (c *targetTcpProxiesRESTClient) List(ctx context.Context, req *computepb.ListTargetTcpProxiesRequest, opts ...gax.CallOption) (*computepb.TargetTcpProxyList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/targetTcpProxies", req.GetProject()) @@ -361,7 +343,7 @@ func (c *targetTcpProxiesRESTClient) List(ctx context.Context, req *computepb.Li baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/target_vpn_gateways_client.go b/compute/apiv1/target_vpn_gateways_client.go index 996e785297f..8d050dee08b 100644 --- a/compute/apiv1/target_vpn_gateways_client.go +++ b/compute/apiv1/target_vpn_gateways_client.go @@ -149,8 +149,8 @@ func NewTargetVpnGatewaysRESTClient(ctx context.Context, opts ...option.ClientOp func defaultTargetVpnGatewaysRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -182,12 +182,6 @@ func (c *targetVpnGatewaysRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of target VPN gateways. func (c *targetVpnGatewaysRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListTargetVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.TargetVpnGatewayAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/targetVpnGateways", req.GetProject()) @@ -213,7 +207,7 @@ func (c *targetVpnGatewaysRESTClient) AggregatedList(ctx context.Context, req *c baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -247,12 +241,6 @@ func (c *targetVpnGatewaysRESTClient) AggregatedList(ctx context.Context, req *c // Delete deletes the specified target VPN gateway. func (c *targetVpnGatewaysRESTClient) Delete(ctx context.Context, req *computepb.DeleteTargetVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetVpnGateways/%v", req.GetProject(), req.GetRegion(), req.GetTargetVpnGateway()) @@ -263,7 +251,7 @@ func (c *targetVpnGatewaysRESTClient) Delete(ctx context.Context, req *computepb baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -297,16 +285,10 @@ func (c *targetVpnGatewaysRESTClient) Delete(ctx context.Context, req *computepb // Get returns the specified target VPN gateway. Gets a list of available target VPN gateways by making a list() request. func (c *targetVpnGatewaysRESTClient) Get(ctx context.Context, req *computepb.GetTargetVpnGatewayRequest, opts ...gax.CallOption) (*computepb.TargetVpnGateway, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetVpnGateways/%v", req.GetProject(), req.GetRegion(), req.GetTargetVpnGateway()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -391,12 +373,6 @@ func (c *targetVpnGatewaysRESTClient) Insert(ctx context.Context, req *computepb // List retrieves a list of target VPN gateways available to the specified project and region. func (c *targetVpnGatewaysRESTClient) List(ctx context.Context, req *computepb.ListTargetVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.TargetVpnGatewayList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/targetVpnGateways", req.GetProject(), req.GetRegion()) @@ -419,7 +395,7 @@ func (c *targetVpnGatewaysRESTClient) List(ctx context.Context, req *computepb.L baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/url_maps_client.go b/compute/apiv1/url_maps_client.go index 798e93645d9..e117b19e9fe 100644 --- a/compute/apiv1/url_maps_client.go +++ b/compute/apiv1/url_maps_client.go @@ -179,8 +179,8 @@ func NewUrlMapsRESTClient(ctx context.Context, opts ...option.ClientOption) (*Ur func defaultUrlMapsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -212,12 +212,6 @@ func (c *urlMapsRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves the list of all UrlMap resources, regional and global, available to the specified project. func (c *urlMapsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListUrlMapsRequest, opts ...gax.CallOption) (*computepb.UrlMapsAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/urlMaps", req.GetProject()) @@ -243,7 +237,7 @@ func (c *urlMapsRESTClient) AggregatedList(ctx context.Context, req *computepb.A baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -277,12 +271,6 @@ func (c *urlMapsRESTClient) AggregatedList(ctx context.Context, req *computepb.A // Delete deletes the specified UrlMap resource. func (c *urlMapsRESTClient) Delete(ctx context.Context, req *computepb.DeleteUrlMapRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/urlMaps/%v", req.GetProject(), req.GetUrlMap()) @@ -293,7 +281,7 @@ func (c *urlMapsRESTClient) Delete(ctx context.Context, req *computepb.DeleteUrl baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -327,16 +315,10 @@ func (c *urlMapsRESTClient) Delete(ctx context.Context, req *computepb.DeleteUrl // Get returns the specified UrlMap resource. Gets a list of available URL maps by making a list() request. func (c *urlMapsRESTClient) Get(ctx context.Context, req *computepb.GetUrlMapRequest, opts ...gax.CallOption) (*computepb.UrlMap, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/urlMaps/%v", req.GetProject(), req.GetUrlMap()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -474,12 +456,6 @@ func (c *urlMapsRESTClient) InvalidateCache(ctx context.Context, req *computepb. // List retrieves the list of UrlMap resources available to the specified project. func (c *urlMapsRESTClient) List(ctx context.Context, req *computepb.ListUrlMapsRequest, opts ...gax.CallOption) (*computepb.UrlMapList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/global/urlMaps", req.GetProject()) @@ -502,7 +478,7 @@ func (c *urlMapsRESTClient) List(ctx context.Context, req *computepb.ListUrlMaps baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/vpn_gateways_client.go b/compute/apiv1/vpn_gateways_client.go index 80eb318a484..4b9a4642d76 100644 --- a/compute/apiv1/vpn_gateways_client.go +++ b/compute/apiv1/vpn_gateways_client.go @@ -170,8 +170,8 @@ func NewVpnGatewaysRESTClient(ctx context.Context, opts ...option.ClientOption) func defaultVpnGatewaysRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -203,12 +203,6 @@ func (c *vpnGatewaysRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of VPN gateways. func (c *vpnGatewaysRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.VpnGatewayAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/vpnGateways", req.GetProject()) @@ -234,7 +228,7 @@ func (c *vpnGatewaysRESTClient) AggregatedList(ctx context.Context, req *compute baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -268,12 +262,6 @@ func (c *vpnGatewaysRESTClient) AggregatedList(ctx context.Context, req *compute // Delete deletes the specified VPN gateway. func (c *vpnGatewaysRESTClient) Delete(ctx context.Context, req *computepb.DeleteVpnGatewayRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnGateways/%v", req.GetProject(), req.GetRegion(), req.GetVpnGateway()) @@ -284,7 +272,7 @@ func (c *vpnGatewaysRESTClient) Delete(ctx context.Context, req *computepb.Delet baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -318,16 +306,10 @@ func (c *vpnGatewaysRESTClient) Delete(ctx context.Context, req *computepb.Delet // Get returns the specified VPN gateway. Gets a list of available VPN gateways by making a list() request. func (c *vpnGatewaysRESTClient) Get(ctx context.Context, req *computepb.GetVpnGatewayRequest, opts ...gax.CallOption) (*computepb.VpnGateway, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnGateways/%v", req.GetProject(), req.GetRegion(), req.GetVpnGateway()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -361,16 +343,10 @@ func (c *vpnGatewaysRESTClient) Get(ctx context.Context, req *computepb.GetVpnGa // GetStatus returns the status for the specified VPN gateway. func (c *vpnGatewaysRESTClient) GetStatus(ctx context.Context, req *computepb.GetStatusVpnGatewayRequest, opts ...gax.CallOption) (*computepb.VpnGatewaysGetStatusResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnGateways/%v/getStatus", req.GetProject(), req.GetRegion(), req.GetVpnGateway()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -455,12 +431,6 @@ func (c *vpnGatewaysRESTClient) Insert(ctx context.Context, req *computepb.Inser // List retrieves a list of VPN gateways available to the specified project and region. func (c *vpnGatewaysRESTClient) List(ctx context.Context, req *computepb.ListVpnGatewaysRequest, opts ...gax.CallOption) (*computepb.VpnGatewayList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnGateways", req.GetProject(), req.GetRegion()) @@ -483,7 +453,7 @@ func (c *vpnGatewaysRESTClient) List(ctx context.Context, req *computepb.ListVpn baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/vpn_tunnels_client.go b/compute/apiv1/vpn_tunnels_client.go index 718d75406b2..62186a5da95 100644 --- a/compute/apiv1/vpn_tunnels_client.go +++ b/compute/apiv1/vpn_tunnels_client.go @@ -149,8 +149,8 @@ func NewVpnTunnelsRESTClient(ctx context.Context, opts ...option.ClientOption) ( func defaultVpnTunnelsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -182,12 +182,6 @@ func (c *vpnTunnelsRESTClient) Connection() *grpc.ClientConn { // AggregatedList retrieves an aggregated list of VPN tunnels. func (c *vpnTunnelsRESTClient) AggregatedList(ctx context.Context, req *computepb.AggregatedListVpnTunnelsRequest, opts ...gax.CallOption) (*computepb.VpnTunnelAggregatedList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/aggregated/vpnTunnels", req.GetProject()) @@ -213,7 +207,7 @@ func (c *vpnTunnelsRESTClient) AggregatedList(ctx context.Context, req *computep baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -247,12 +241,6 @@ func (c *vpnTunnelsRESTClient) AggregatedList(ctx context.Context, req *computep // Delete deletes the specified VpnTunnel resource. func (c *vpnTunnelsRESTClient) Delete(ctx context.Context, req *computepb.DeleteVpnTunnelRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnTunnels/%v", req.GetProject(), req.GetRegion(), req.GetVpnTunnel()) @@ -263,7 +251,7 @@ func (c *vpnTunnelsRESTClient) Delete(ctx context.Context, req *computepb.Delete baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -297,16 +285,10 @@ func (c *vpnTunnelsRESTClient) Delete(ctx context.Context, req *computepb.Delete // Get returns the specified VpnTunnel resource. Gets a list of available VPN tunnels by making a list() request. func (c *vpnTunnelsRESTClient) Get(ctx context.Context, req *computepb.GetVpnTunnelRequest, opts ...gax.CallOption) (*computepb.VpnTunnel, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnTunnels/%v", req.GetProject(), req.GetRegion(), req.GetVpnTunnel()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -391,12 +373,6 @@ func (c *vpnTunnelsRESTClient) Insert(ctx context.Context, req *computepb.Insert // List retrieves a list of VpnTunnel resources contained in the specified project and region. func (c *vpnTunnelsRESTClient) List(ctx context.Context, req *computepb.ListVpnTunnelsRequest, opts ...gax.CallOption) (*computepb.VpnTunnelList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/regions/%v/vpnTunnels", req.GetProject(), req.GetRegion()) @@ -419,7 +395,7 @@ func (c *vpnTunnelsRESTClient) List(ctx context.Context, req *computepb.ListVpnT baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/zone_operations_client.go b/compute/apiv1/zone_operations_client.go index e77c5b33300..cb8b95c4a5c 100644 --- a/compute/apiv1/zone_operations_client.go +++ b/compute/apiv1/zone_operations_client.go @@ -17,7 +17,6 @@ package compute import ( - "bytes" "context" "fmt" "io/ioutil" @@ -148,8 +147,8 @@ func NewZoneOperationsRESTClient(ctx context.Context, opts ...option.ClientOptio func defaultZoneOperationsRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -181,16 +180,10 @@ func (c *zoneOperationsRESTClient) Connection() *grpc.ClientConn { // Delete deletes the specified zone-specific Operations resource. func (c *zoneOperationsRESTClient) Delete(ctx context.Context, req *computepb.DeleteZoneOperationRequest, opts ...gax.CallOption) (*computepb.DeleteZoneOperationResponse, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/operations/%v", req.GetProject(), req.GetZone(), req.GetOperation()) - httpReq, err := http.NewRequest("DELETE", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("DELETE", baseUrl.String(), nil) if err != nil { return nil, err } @@ -224,16 +217,10 @@ func (c *zoneOperationsRESTClient) Delete(ctx context.Context, req *computepb.De // Get retrieves the specified zone-specific Operations resource. func (c *zoneOperationsRESTClient) Get(ctx context.Context, req *computepb.GetZoneOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/operations/%v", req.GetProject(), req.GetZone(), req.GetOperation()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -267,12 +254,6 @@ func (c *zoneOperationsRESTClient) Get(ctx context.Context, req *computepb.GetZo // List retrieves a list of Operation resources contained within the specified zone. func (c *zoneOperationsRESTClient) List(ctx context.Context, req *computepb.ListZoneOperationsRequest, opts ...gax.CallOption) (*computepb.OperationList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/operations", req.GetProject(), req.GetZone()) @@ -295,7 +276,7 @@ func (c *zoneOperationsRESTClient) List(ctx context.Context, req *computepb.List baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -335,16 +316,10 @@ func (c *zoneOperationsRESTClient) List(ctx context.Context, req *computepb.List // // If the default deadline is reached, there is no guarantee that the operation is actually done when the method returns. Be prepared to retry if the operation is not DONE. func (c *zoneOperationsRESTClient) Wait(ctx context.Context, req *computepb.WaitZoneOperationRequest, opts ...gax.CallOption) (*computepb.Operation, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/operations/%v/wait", req.GetProject(), req.GetZone(), req.GetOperation()) - httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("POST", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/compute/apiv1/zones_client.go b/compute/apiv1/zones_client.go index bc02f75e4b6..96d6a8d1a6d 100644 --- a/compute/apiv1/zones_client.go +++ b/compute/apiv1/zones_client.go @@ -17,7 +17,6 @@ package compute import ( - "bytes" "context" "fmt" "io/ioutil" @@ -128,8 +127,8 @@ func NewZonesRESTClient(ctx context.Context, opts ...option.ClientOption) (*Zone func defaultZonesRESTClientOptions() []option.ClientOption { return []option.ClientOption{ - internaloption.WithDefaultEndpoint("compute.googleapis.com"), - internaloption.WithDefaultMTLSEndpoint("compute.mtls.googleapis.com"), + internaloption.WithDefaultEndpoint("https://compute.googleapis.com"), + internaloption.WithDefaultMTLSEndpoint("https://compute.mtls.googleapis.com"), internaloption.WithDefaultAudience("https://compute.googleapis.com/"), internaloption.WithDefaultScopes(DefaultAuthScopes()...), } @@ -161,16 +160,10 @@ func (c *zonesRESTClient) Connection() *grpc.ClientConn { // Get returns the specified Zone resource. Gets a list of available zones by making a list() request. func (c *zonesRESTClient) Get(ctx context.Context, req *computepb.GetZoneRequest, opts ...gax.CallOption) (*computepb.Zone, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v", req.GetProject(), req.GetZone()) - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } @@ -204,12 +197,6 @@ func (c *zonesRESTClient) Get(ctx context.Context, req *computepb.GetZoneRequest // List retrieves the list of Zone resources available to the specified project. func (c *zonesRESTClient) List(ctx context.Context, req *computepb.ListZonesRequest, opts ...gax.CallOption) (*computepb.ZoneList, error) { - m := protojson.MarshalOptions{AllowPartial: true, EmitUnpopulated: true} - jsonReq, err := m.Marshal(req) - if err != nil { - return nil, err - } - baseUrl, _ := url.Parse(c.endpoint) baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones", req.GetProject()) @@ -232,7 +219,7 @@ func (c *zonesRESTClient) List(ctx context.Context, req *computepb.ListZonesRequ baseUrl.RawQuery = params.Encode() - httpReq, err := http.NewRequest("GET", baseUrl.String(), bytes.NewReader(jsonReq)) + httpReq, err := http.NewRequest("GET", baseUrl.String(), nil) if err != nil { return nil, err } diff --git a/go.mod b/go.mod index ffea1b3e160..72d24e1bd90 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( golang.org/x/text v0.3.6 golang.org/x/tools v0.1.4 google.golang.org/api v0.50.0 - google.golang.org/genproto v0.0.0-20210707141755-0f065b0b1eb9 + google.golang.org/genproto v0.0.0-20210707164411-8c882eb9abba google.golang.org/grpc v1.39.0 google.golang.org/protobuf v1.27.1 ) diff --git a/go.sum b/go.sum index 2b6aadeb40b..b879f8b70d4 100644 --- a/go.sum +++ b/go.sum @@ -466,8 +466,8 @@ google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxH google.golang.org/genproto v0.0.0-20210604141403-392c879c8b08/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210608205507-b6d2f5bf0d7d/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0= google.golang.org/genproto v0.0.0-20210624195500-8bfb893ecb84/go.mod h1:SzzZ/N+nwJDaO1kznhnlzqS8ocJICar6hYhVyhi++24= -google.golang.org/genproto v0.0.0-20210707141755-0f065b0b1eb9 h1:F2TjstHaRqe0vj9LuGmkPaOn0nw0DVRTUqx0aAkn8JM= -google.golang.org/genproto v0.0.0-20210707141755-0f065b0b1eb9/go.mod h1:yiaVoXHpRzHGyxV3o4DktVWY4mSUErTKaeEOq6C3t3U= +google.golang.org/genproto v0.0.0-20210707164411-8c882eb9abba h1:7ajVqfUjhvVuXCb+sdXdKsOD53caRpfMofvihWF1314= +google.golang.org/genproto v0.0.0-20210707164411-8c882eb9abba/go.mod h1:AxrInvYm1dci+enl5hChSFPOmmUF1+uAa/UsgNRWd7k= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=