parent
326f0cfa2f
commit
5c292c61c6
1437 changed files with 208886 additions and 87131 deletions
465
vendor/cloud.google.com/go/compute/apiv1/disks_client.go
generated
vendored
465
vendor/cloud.google.com/go/compute/apiv1/disks_client.go
generated
vendored
|
|
@ -20,7 +20,7 @@ import (
|
|||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"io"
|
||||
"math"
|
||||
"net/http"
|
||||
"net/url"
|
||||
|
|
@ -44,26 +44,33 @@ var newDisksClientHook clientHook
|
|||
|
||||
// DisksCallOptions contains the retry settings for each method of DisksClient.
|
||||
type DisksCallOptions struct {
|
||||
AddResourcePolicies []gax.CallOption
|
||||
AggregatedList []gax.CallOption
|
||||
CreateSnapshot []gax.CallOption
|
||||
Delete []gax.CallOption
|
||||
Get []gax.CallOption
|
||||
GetIamPolicy []gax.CallOption
|
||||
Insert []gax.CallOption
|
||||
List []gax.CallOption
|
||||
RemoveResourcePolicies []gax.CallOption
|
||||
Resize []gax.CallOption
|
||||
SetIamPolicy []gax.CallOption
|
||||
SetLabels []gax.CallOption
|
||||
TestIamPermissions []gax.CallOption
|
||||
Update []gax.CallOption
|
||||
AddResourcePolicies []gax.CallOption
|
||||
AggregatedList []gax.CallOption
|
||||
BulkInsert []gax.CallOption
|
||||
CreateSnapshot []gax.CallOption
|
||||
Delete []gax.CallOption
|
||||
Get []gax.CallOption
|
||||
GetIamPolicy []gax.CallOption
|
||||
Insert []gax.CallOption
|
||||
List []gax.CallOption
|
||||
RemoveResourcePolicies []gax.CallOption
|
||||
Resize []gax.CallOption
|
||||
SetIamPolicy []gax.CallOption
|
||||
SetLabels []gax.CallOption
|
||||
StartAsyncReplication []gax.CallOption
|
||||
StopAsyncReplication []gax.CallOption
|
||||
StopGroupAsyncReplication []gax.CallOption
|
||||
TestIamPermissions []gax.CallOption
|
||||
Update []gax.CallOption
|
||||
}
|
||||
|
||||
func defaultDisksRESTCallOptions() *DisksCallOptions {
|
||||
return &DisksCallOptions{
|
||||
AddResourcePolicies: []gax.CallOption{},
|
||||
AddResourcePolicies: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
AggregatedList: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnHTTPCodes(gax.Backoff{
|
||||
Initial: 100 * time.Millisecond,
|
||||
|
|
@ -74,9 +81,17 @@ func defaultDisksRESTCallOptions() *DisksCallOptions {
|
|||
http.StatusServiceUnavailable)
|
||||
}),
|
||||
},
|
||||
CreateSnapshot: []gax.CallOption{},
|
||||
Delete: []gax.CallOption{},
|
||||
BulkInsert: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
CreateSnapshot: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
Delete: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
Get: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnHTTPCodes(gax.Backoff{
|
||||
Initial: 100 * time.Millisecond,
|
||||
|
|
@ -88,6 +103,7 @@ func defaultDisksRESTCallOptions() *DisksCallOptions {
|
|||
}),
|
||||
},
|
||||
GetIamPolicy: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnHTTPCodes(gax.Backoff{
|
||||
Initial: 100 * time.Millisecond,
|
||||
|
|
@ -98,8 +114,11 @@ func defaultDisksRESTCallOptions() *DisksCallOptions {
|
|||
http.StatusServiceUnavailable)
|
||||
}),
|
||||
},
|
||||
Insert: []gax.CallOption{},
|
||||
Insert: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
List: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
gax.WithRetry(func() gax.Retryer {
|
||||
return gax.OnHTTPCodes(gax.Backoff{
|
||||
Initial: 100 * time.Millisecond,
|
||||
|
|
@ -110,12 +129,33 @@ func defaultDisksRESTCallOptions() *DisksCallOptions {
|
|||
http.StatusServiceUnavailable)
|
||||
}),
|
||||
},
|
||||
RemoveResourcePolicies: []gax.CallOption{},
|
||||
Resize: []gax.CallOption{},
|
||||
SetIamPolicy: []gax.CallOption{},
|
||||
SetLabels: []gax.CallOption{},
|
||||
TestIamPermissions: []gax.CallOption{},
|
||||
Update: []gax.CallOption{},
|
||||
RemoveResourcePolicies: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
Resize: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
SetIamPolicy: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
SetLabels: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
StartAsyncReplication: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
StopAsyncReplication: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
StopGroupAsyncReplication: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
TestIamPermissions: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
Update: []gax.CallOption{
|
||||
gax.WithTimeout(600000 * time.Millisecond),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -126,6 +166,7 @@ type internalDisksClient interface {
|
|||
Connection() *grpc.ClientConn
|
||||
AddResourcePolicies(context.Context, *computepb.AddResourcePoliciesDiskRequest, ...gax.CallOption) (*Operation, error)
|
||||
AggregatedList(context.Context, *computepb.AggregatedListDisksRequest, ...gax.CallOption) *DisksScopedListPairIterator
|
||||
BulkInsert(context.Context, *computepb.BulkInsertDiskRequest, ...gax.CallOption) (*Operation, error)
|
||||
CreateSnapshot(context.Context, *computepb.CreateSnapshotDiskRequest, ...gax.CallOption) (*Operation, error)
|
||||
Delete(context.Context, *computepb.DeleteDiskRequest, ...gax.CallOption) (*Operation, error)
|
||||
Get(context.Context, *computepb.GetDiskRequest, ...gax.CallOption) (*computepb.Disk, error)
|
||||
|
|
@ -136,6 +177,9 @@ type internalDisksClient interface {
|
|||
Resize(context.Context, *computepb.ResizeDiskRequest, ...gax.CallOption) (*Operation, error)
|
||||
SetIamPolicy(context.Context, *computepb.SetIamPolicyDiskRequest, ...gax.CallOption) (*computepb.Policy, error)
|
||||
SetLabels(context.Context, *computepb.SetLabelsDiskRequest, ...gax.CallOption) (*Operation, error)
|
||||
StartAsyncReplication(context.Context, *computepb.StartAsyncReplicationDiskRequest, ...gax.CallOption) (*Operation, error)
|
||||
StopAsyncReplication(context.Context, *computepb.StopAsyncReplicationDiskRequest, ...gax.CallOption) (*Operation, error)
|
||||
StopGroupAsyncReplication(context.Context, *computepb.StopGroupAsyncReplicationDiskRequest, ...gax.CallOption) (*Operation, error)
|
||||
TestIamPermissions(context.Context, *computepb.TestIamPermissionsDiskRequest, ...gax.CallOption) (*computepb.TestPermissionsResponse, error)
|
||||
Update(context.Context, *computepb.UpdateDiskRequest, ...gax.CallOption) (*Operation, error)
|
||||
}
|
||||
|
|
@ -185,6 +229,11 @@ func (c *DisksClient) AggregatedList(ctx context.Context, req *computepb.Aggrega
|
|||
return c.internalClient.AggregatedList(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// BulkInsert bulk create a set of disks.
|
||||
func (c *DisksClient) BulkInsert(ctx context.Context, req *computepb.BulkInsertDiskRequest, opts ...gax.CallOption) (*Operation, error) {
|
||||
return c.internalClient.BulkInsert(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// CreateSnapshot creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project.
|
||||
func (c *DisksClient) CreateSnapshot(ctx context.Context, req *computepb.CreateSnapshotDiskRequest, opts ...gax.CallOption) (*Operation, error) {
|
||||
return c.internalClient.CreateSnapshot(ctx, req, opts...)
|
||||
|
|
@ -235,6 +284,21 @@ func (c *DisksClient) SetLabels(ctx context.Context, req *computepb.SetLabelsDis
|
|||
return c.internalClient.SetLabels(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// StartAsyncReplication starts asynchronous replication. Must be invoked on the primary disk.
|
||||
func (c *DisksClient) StartAsyncReplication(ctx context.Context, req *computepb.StartAsyncReplicationDiskRequest, opts ...gax.CallOption) (*Operation, error) {
|
||||
return c.internalClient.StartAsyncReplication(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// StopAsyncReplication stops asynchronous replication. Can be invoked either on the primary or on the secondary disk.
|
||||
func (c *DisksClient) StopAsyncReplication(ctx context.Context, req *computepb.StopAsyncReplicationDiskRequest, opts ...gax.CallOption) (*Operation, error) {
|
||||
return c.internalClient.StopAsyncReplication(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// StopGroupAsyncReplication stops asynchronous replication for a consistency group of disks. Can be invoked either in the primary or secondary scope.
|
||||
func (c *DisksClient) StopGroupAsyncReplication(ctx context.Context, req *computepb.StopGroupAsyncReplicationDiskRequest, opts ...gax.CallOption) (*Operation, error) {
|
||||
return c.internalClient.StopGroupAsyncReplication(ctx, req, opts...)
|
||||
}
|
||||
|
||||
// TestIamPermissions returns permissions that a caller has on the specified resource.
|
||||
func (c *DisksClient) TestIamPermissions(ctx context.Context, req *computepb.TestIamPermissionsDiskRequest, opts ...gax.CallOption) (*computepb.TestPermissionsResponse, error) {
|
||||
return c.internalClient.TestIamPermissions(ctx, req, opts...)
|
||||
|
|
@ -307,7 +371,7 @@ func defaultDisksRESTClientOptions() []option.ClientOption {
|
|||
// the `x-goog-api-client` header passed on each request. Intended for
|
||||
// use by Google-written clients.
|
||||
func (c *disksRESTClient) setGoogleClientInfo(keyval ...string) {
|
||||
kv := append([]string{"gl-go", versionGo()}, keyval...)
|
||||
kv := append([]string{"gl-go", gax.GoVersion}, keyval...)
|
||||
kv = append(kv, "gapic", getVersionClient(), "gax", gax.Version, "rest", "UNKNOWN")
|
||||
c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...))
|
||||
}
|
||||
|
|
@ -380,13 +444,13 @@ func (c *disksRESTClient) AddResourcePolicies(ctx context.Context, req *computep
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -470,13 +534,13 @@ func (c *disksRESTClient) AggregatedList(ctx context.Context, req *computepb.Agg
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -511,6 +575,81 @@ func (c *disksRESTClient) AggregatedList(ctx context.Context, req *computepb.Agg
|
|||
return it
|
||||
}
|
||||
|
||||
// BulkInsert bulk create a set of disks.
|
||||
func (c *disksRESTClient) BulkInsert(ctx context.Context, req *computepb.BulkInsertDiskRequest, opts ...gax.CallOption) (*Operation, error) {
|
||||
m := protojson.MarshalOptions{AllowPartial: true}
|
||||
body := req.GetBulkInsertDiskResourceResource()
|
||||
jsonReq, err := m.Marshal(body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
baseUrl, err := url.Parse(c.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/bulkInsert", req.GetProject(), req.GetZone())
|
||||
|
||||
params := url.Values{}
|
||||
if req != nil && req.RequestId != nil {
|
||||
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
|
||||
}
|
||||
|
||||
baseUrl.RawQuery = params.Encode()
|
||||
|
||||
// Build HTTP headers from client and context metadata.
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "zone", url.QueryEscape(req.GetZone())))
|
||||
|
||||
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
|
||||
opts = append((*c.CallOptions).BulkInsert[0:len((*c.CallOptions).BulkInsert):len((*c.CallOptions).BulkInsert)], opts...)
|
||||
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
|
||||
resp := &computepb.Operation{}
|
||||
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
if settings.Path != "" {
|
||||
baseUrl.Path = settings.Path
|
||||
}
|
||||
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq = httpReq.WithContext(ctx)
|
||||
httpReq.Header = headers
|
||||
|
||||
httpRsp, err := c.httpClient.Do(httpReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer httpRsp.Body.Close()
|
||||
|
||||
if err = googleapi.CheckResponse(httpRsp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}, opts...)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
op := &Operation{
|
||||
&zoneOperationsHandle{
|
||||
c: c.operationClient,
|
||||
proto: resp,
|
||||
project: req.GetProject(),
|
||||
zone: req.GetZone(),
|
||||
},
|
||||
}
|
||||
return op, nil
|
||||
}
|
||||
|
||||
// CreateSnapshot creates a snapshot of a specified persistent disk. For regular snapshot creation, consider using snapshots.insert instead, as that method supports more features, such as creating snapshots in a project different from the source disk project.
|
||||
func (c *disksRESTClient) CreateSnapshot(ctx context.Context, req *computepb.CreateSnapshotDiskRequest, opts ...gax.CallOption) (*Operation, error) {
|
||||
m := protojson.MarshalOptions{AllowPartial: true}
|
||||
|
|
@ -564,13 +703,13 @@ func (c *disksRESTClient) CreateSnapshot(ctx context.Context, req *computepb.Cre
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -632,13 +771,13 @@ func (c *disksRESTClient) Delete(ctx context.Context, req *computepb.DeleteDiskR
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -693,13 +832,13 @@ func (c *disksRESTClient) Get(ctx context.Context, req *computepb.GetDiskRequest
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -753,13 +892,13 @@ func (c *disksRESTClient) GetIamPolicy(ctx context.Context, req *computepb.GetIa
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -823,13 +962,13 @@ func (c *disksRESTClient) Insert(ctx context.Context, req *computepb.InsertDiskR
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -910,13 +1049,13 @@ func (c *disksRESTClient) List(ctx context.Context, req *computepb.ListDisksRequ
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -994,13 +1133,13 @@ func (c *disksRESTClient) RemoveResourcePolicies(ctx context.Context, req *compu
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -1069,13 +1208,13 @@ func (c *disksRESTClient) Resize(ctx context.Context, req *computepb.ResizeDiskR
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -1137,13 +1276,13 @@ func (c *disksRESTClient) SetIamPolicy(ctx context.Context, req *computepb.SetIa
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -1204,13 +1343,231 @@ func (c *disksRESTClient) SetLabels(ctx context.Context, req *computepb.SetLabel
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}, opts...)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
op := &Operation{
|
||||
&zoneOperationsHandle{
|
||||
c: c.operationClient,
|
||||
proto: resp,
|
||||
project: req.GetProject(),
|
||||
zone: req.GetZone(),
|
||||
},
|
||||
}
|
||||
return op, nil
|
||||
}
|
||||
|
||||
// StartAsyncReplication starts asynchronous replication. Must be invoked on the primary disk.
|
||||
func (c *disksRESTClient) StartAsyncReplication(ctx context.Context, req *computepb.StartAsyncReplicationDiskRequest, opts ...gax.CallOption) (*Operation, error) {
|
||||
m := protojson.MarshalOptions{AllowPartial: true}
|
||||
body := req.GetDisksStartAsyncReplicationRequestResource()
|
||||
jsonReq, err := m.Marshal(body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
baseUrl, err := url.Parse(c.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v/startAsyncReplication", req.GetProject(), req.GetZone(), req.GetDisk())
|
||||
|
||||
params := url.Values{}
|
||||
if req != nil && req.RequestId != nil {
|
||||
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
|
||||
}
|
||||
|
||||
baseUrl.RawQuery = params.Encode()
|
||||
|
||||
// Build HTTP headers from client and context metadata.
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "zone", url.QueryEscape(req.GetZone()), "disk", url.QueryEscape(req.GetDisk())))
|
||||
|
||||
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
|
||||
opts = append((*c.CallOptions).StartAsyncReplication[0:len((*c.CallOptions).StartAsyncReplication):len((*c.CallOptions).StartAsyncReplication)], opts...)
|
||||
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
|
||||
resp := &computepb.Operation{}
|
||||
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
if settings.Path != "" {
|
||||
baseUrl.Path = settings.Path
|
||||
}
|
||||
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq = httpReq.WithContext(ctx)
|
||||
httpReq.Header = headers
|
||||
|
||||
httpRsp, err := c.httpClient.Do(httpReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer httpRsp.Body.Close()
|
||||
|
||||
if err = googleapi.CheckResponse(httpRsp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}, opts...)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
op := &Operation{
|
||||
&zoneOperationsHandle{
|
||||
c: c.operationClient,
|
||||
proto: resp,
|
||||
project: req.GetProject(),
|
||||
zone: req.GetZone(),
|
||||
},
|
||||
}
|
||||
return op, nil
|
||||
}
|
||||
|
||||
// StopAsyncReplication stops asynchronous replication. Can be invoked either on the primary or on the secondary disk.
|
||||
func (c *disksRESTClient) StopAsyncReplication(ctx context.Context, req *computepb.StopAsyncReplicationDiskRequest, opts ...gax.CallOption) (*Operation, error) {
|
||||
baseUrl, err := url.Parse(c.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/%v/stopAsyncReplication", req.GetProject(), req.GetZone(), req.GetDisk())
|
||||
|
||||
params := url.Values{}
|
||||
if req != nil && req.RequestId != nil {
|
||||
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
|
||||
}
|
||||
|
||||
baseUrl.RawQuery = params.Encode()
|
||||
|
||||
// Build HTTP headers from client and context metadata.
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "zone", url.QueryEscape(req.GetZone()), "disk", url.QueryEscape(req.GetDisk())))
|
||||
|
||||
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
|
||||
opts = append((*c.CallOptions).StopAsyncReplication[0:len((*c.CallOptions).StopAsyncReplication):len((*c.CallOptions).StopAsyncReplication)], opts...)
|
||||
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
|
||||
resp := &computepb.Operation{}
|
||||
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
if settings.Path != "" {
|
||||
baseUrl.Path = settings.Path
|
||||
}
|
||||
httpReq, err := http.NewRequest("POST", baseUrl.String(), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq = httpReq.WithContext(ctx)
|
||||
httpReq.Header = headers
|
||||
|
||||
httpRsp, err := c.httpClient.Do(httpReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer httpRsp.Body.Close()
|
||||
|
||||
if err = googleapi.CheckResponse(httpRsp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}, opts...)
|
||||
if e != nil {
|
||||
return nil, e
|
||||
}
|
||||
op := &Operation{
|
||||
&zoneOperationsHandle{
|
||||
c: c.operationClient,
|
||||
proto: resp,
|
||||
project: req.GetProject(),
|
||||
zone: req.GetZone(),
|
||||
},
|
||||
}
|
||||
return op, nil
|
||||
}
|
||||
|
||||
// StopGroupAsyncReplication stops asynchronous replication for a consistency group of disks. Can be invoked either in the primary or secondary scope.
|
||||
func (c *disksRESTClient) StopGroupAsyncReplication(ctx context.Context, req *computepb.StopGroupAsyncReplicationDiskRequest, opts ...gax.CallOption) (*Operation, error) {
|
||||
m := protojson.MarshalOptions{AllowPartial: true}
|
||||
body := req.GetDisksStopGroupAsyncReplicationResourceResource()
|
||||
jsonReq, err := m.Marshal(body)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
baseUrl, err := url.Parse(c.endpoint)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
baseUrl.Path += fmt.Sprintf("/compute/v1/projects/%v/zones/%v/disks/stopGroupAsyncReplication", req.GetProject(), req.GetZone())
|
||||
|
||||
params := url.Values{}
|
||||
if req != nil && req.RequestId != nil {
|
||||
params.Add("requestId", fmt.Sprintf("%v", req.GetRequestId()))
|
||||
}
|
||||
|
||||
baseUrl.RawQuery = params.Encode()
|
||||
|
||||
// Build HTTP headers from client and context metadata.
|
||||
md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v&%s=%v", "project", url.QueryEscape(req.GetProject()), "zone", url.QueryEscape(req.GetZone())))
|
||||
|
||||
headers := buildHeaders(ctx, c.xGoogMetadata, md, metadata.Pairs("Content-Type", "application/json"))
|
||||
opts = append((*c.CallOptions).StopGroupAsyncReplication[0:len((*c.CallOptions).StopGroupAsyncReplication):len((*c.CallOptions).StopGroupAsyncReplication)], opts...)
|
||||
unm := protojson.UnmarshalOptions{AllowPartial: true, DiscardUnknown: true}
|
||||
resp := &computepb.Operation{}
|
||||
e := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error {
|
||||
if settings.Path != "" {
|
||||
baseUrl.Path = settings.Path
|
||||
}
|
||||
httpReq, err := http.NewRequest("POST", baseUrl.String(), bytes.NewReader(jsonReq))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
httpReq = httpReq.WithContext(ctx)
|
||||
httpReq.Header = headers
|
||||
|
||||
httpRsp, err := c.httpClient.Do(httpReq)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer httpRsp.Body.Close()
|
||||
|
||||
if err = googleapi.CheckResponse(httpRsp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -1272,13 +1629,13 @@ func (c *disksRESTClient) TestIamPermissions(ctx context.Context, req *computepb
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
@ -1345,13 +1702,13 @@ func (c *disksRESTClient) Update(ctx context.Context, req *computepb.UpdateDiskR
|
|||
return err
|
||||
}
|
||||
|
||||
buf, err := ioutil.ReadAll(httpRsp.Body)
|
||||
buf, err := io.ReadAll(httpRsp.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := unm.Unmarshal(buf, resp); err != nil {
|
||||
return maybeUnknownEnum(err)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue