Identity and Access Management (IAM) API v2 - Package cloud.google.com/go/iam/apiv2 (v0.5.0)

Package iam is an auto-generated package for the Identity and Access Management (IAM) API.

Manages identity and access control for Google Cloud Platform resources, including the creation of service accounts, which you can use to authenticate to Google and make API calls.

 NOTE 
 : 
  
 This 
  
 package 
  
 is 
  
 in 
  
 beta 
 . 
  
 It 
  
 is 
  
 not 
  
 stable 
 , 
  
 and 
  
 may 
  
 be 
  
 subject 
  
 to 
  
 changes 
 . 

Example usage

To get started with this package, create a client.

 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
 // This snippet has been automatically generated and should be regarded as a code template only. 
 // It will require modifications to work: 
 // - It may require correct/in-range values for request initialization. 
 // - It may require specifying regional endpoints when creating the service client as shown in: 
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
 c 
 , 
  
 err 
  
 := 
  
 iam 
 . 
 NewPoliciesClient 
 ( 
 ctx 
 ) 
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
 } 
 defer 
  
 c 
 . 
 Close 
 () 

The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.

Using the Client

The following is an example of making an API call with the newly created client.

 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
 // This snippet has been automatically generated and should be regarded as a code template only. 
 // It will require modifications to work: 
 // - It may require correct/in-range values for request initialization. 
 // - It may require specifying regional endpoints when creating the service client as shown in: 
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
 c 
 , 
  
 err 
  
 := 
  
 iam 
 . 
 NewPoliciesClient 
 ( 
 ctx 
 ) 
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
 } 
 defer 
  
 c 
 . 
 Close 
 () 
 req 
  
 := 
  
& iampb 
 . 
 ListPoliciesRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v2#ListPoliciesRequest. 
 } 
 it 
  
 := 
  
 c 
 . 
 ListPolicies 
 ( 
 ctx 
 , 
  
 req 
 ) 
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 it 
 . 
 Next 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
 Done 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 

Use of Context

The ctx passed to NewPoliciesClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go .

Functions

func DefaultAuthScopes

  func 
  
 DefaultAuthScopes 
 () 
  
 [] 
  string 
 
 

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

CreatePolicyOperation

  type 
  
 CreatePolicyOperation 
  
 struct 
  
 { 
  
 // contains filtered or unexported fields 
 } 
 

CreatePolicyOperation manages a long-running operation from CreatePolicy.

func (*CreatePolicyOperation) Done

  func 
  
 ( 
 op 
  
 * 
  CreatePolicyOperation 
 
 ) 
  
 Done 
 () 
  
  bool 
 
 

Done reports whether the long-running operation has completed.

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*CreatePolicyOperation) Name

  func 
  
 ( 
 op 
  
 * 
  CreatePolicyOperation 
 
 ) 
  
 Name 
 () 
  
  string 
 
 

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*CreatePolicyOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*CreatePolicyOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

DeletePolicyOperation

  type 
  
 DeletePolicyOperation 
  
 struct 
  
 { 
  
 // contains filtered or unexported fields 
 } 
 

DeletePolicyOperation manages a long-running operation from DeletePolicy.

func (*DeletePolicyOperation) Done

  func 
  
 ( 
 op 
  
 * 
  DeletePolicyOperation 
 
 ) 
  
 Done 
 () 
  
  bool 
 
 

Done reports whether the long-running operation has completed.

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*DeletePolicyOperation) Name

  func 
  
 ( 
 op 
  
 * 
  DeletePolicyOperation 
 
 ) 
  
 Name 
 () 
  
  string 
 
 

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*DeletePolicyOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*DeletePolicyOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

PoliciesCallOptions

  type 
  
 PoliciesCallOptions 
  
 struct 
  
 { 
  
 ListPolicies 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetPolicy 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 CreatePolicy 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 UpdatePolicy 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 DeletePolicy 
  
 [] 
  gax 
 
 . 
  CallOption 
 
  
 GetOperation 
  
 [] 
  gax 
 
 . 
  CallOption 
 
 } 
 

PoliciesCallOptions contains the retry settings for each method of PoliciesClient.

PoliciesClient

  type 
  
 PoliciesClient 
  
 struct 
  
 { 
  
 // The call options for this service. 
  
 CallOptions 
  
 * 
  PoliciesCallOptions 
 
  
 // LROClient is used internally to handle long-running operations. 
  
 // It is exposed so that its CallOptions can be modified if required. 
  
 // Users should not Close this client. 
  
 LROClient 
  
 * 
  lroauto 
 
 . 
  OperationsClient 
 
  
 // contains filtered or unexported fields 
 } 
 

PoliciesClient is a client for interacting with Identity and Access Management (IAM) API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

An interface for managing Identity and Access Management (IAM) policies.

func NewPoliciesClient

  func 
  
 NewPoliciesClient 
 ( 
 ctx 
  
  context 
 
 . 
  Context 
 
 , 
  
 opts 
  
 ... 
  option 
 
 . 
  ClientOption 
 
 ) 
  
 ( 
 * 
  PoliciesClient 
 
 , 
  
  error 
 
 ) 
 

NewPoliciesClient creates a new policies client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

An interface for managing Identity and Access Management (IAM) policies.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 iam 
  
 "cloud.google.com/go/iam/apiv2" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 iam 
 . 
 NewPoliciesClient 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 // TODO: Use client. 
  
 _ 
  
 = 
  
 c 
 } 
 

func (*PoliciesClient) Close

  func 
  
 ( 
 c 
  
 * 
  PoliciesClient 
 
 ) 
  
 Close 
 () 
  
  error 
 
 

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*PoliciesClient) Connection (deprecated)

  func 
  
 ( 
 c 
  
 * 
  PoliciesClient 
 
 ) 
  
 Connection 
 () 
  
 * 
  grpc 
 
 . 
  ClientConn 
 
 

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*PoliciesClient) CreatePolicy

CreatePolicy creates a policy.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 iam 
  
 "cloud.google.com/go/iam/apiv2" 
  
 iampb 
  
 "google.golang.org/genproto/googleapis/iam/v2" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 iam 
 . 
 NewPoliciesClient 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& iampb 
 . 
  CreatePolicyRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v2#CreatePolicyRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 CreatePolicy 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*PoliciesClient) CreatePolicyOperation

  func 
  
 ( 
 c 
  
 * 
  PoliciesClient 
 
 ) 
  
 CreatePolicyOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  CreatePolicyOperation 
 
 

CreatePolicyOperation returns a new CreatePolicyOperation from a given name. The name must be that of a previously created CreatePolicyOperation, possibly from a different process.

func (*PoliciesClient) DeletePolicy

DeletePolicy deletes a policy. This action is permanent.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 iam 
  
 "cloud.google.com/go/iam/apiv2" 
  
 iampb 
  
 "google.golang.org/genproto/googleapis/iam/v2" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 iam 
 . 
 NewPoliciesClient 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& iampb 
 . 
  DeletePolicyRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v2#DeletePolicyRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 DeletePolicy 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*PoliciesClient) DeletePolicyOperation

  func 
  
 ( 
 c 
  
 * 
  PoliciesClient 
 
 ) 
  
 DeletePolicyOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  DeletePolicyOperation 
 
 

DeletePolicyOperation returns a new DeletePolicyOperation from a given name. The name must be that of a previously created DeletePolicyOperation, possibly from a different process.

func (*PoliciesClient) GetOperation

GetOperation is a utility method from google.longrunning.Operations.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 iam 
  
 "cloud.google.com/go/iam/apiv2" 
  
 longrunningpb 
  
 "google.golang.org/genproto/googleapis/longrunning" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 iam 
 . 
 NewPoliciesClient 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& longrunningpb 
 . 
 GetOperationRequest 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/longrunning#GetOperationRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
  GetOperation 
 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*PoliciesClient) GetPolicy

GetPolicy gets a policy.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 iam 
  
 "cloud.google.com/go/iam/apiv2" 
  
 iampb 
  
 "google.golang.org/genproto/googleapis/iam/v2" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 iam 
 . 
 NewPoliciesClient 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& iampb 
 . 
  GetPolicyRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v2#GetPolicyRequest. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 c 
 . 
 GetPolicy 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*PoliciesClient) ListPolicies

ListPolicies retrieves the policies of the specified kind that are attached to a resource.

The response lists only policy metadata. In particular, policy rules are omitted.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 iam 
  
 "cloud.google.com/go/iam/apiv2" 
  
 "google.golang.org/api/iterator" 
  
 iampb 
  
 "google.golang.org/genproto/googleapis/iam/v2" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 iam 
 . 
 NewPoliciesClient 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& iampb 
 . 
  ListPoliciesRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v2#ListPoliciesRequest. 
  
 } 
  
 it 
  
 := 
  
 c 
 . 
 ListPolicies 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 for 
  
 { 
  
 resp 
 , 
  
 err 
  
 := 
  
 it 
 . 
  Next 
 
 () 
  
 if 
  
 err 
  
 == 
  
 iterator 
 . 
 Done 
  
 { 
  
 break 
  
 } 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
  
 } 
 } 
 

func (*PoliciesClient) UpdatePolicy

UpdatePolicy updates the specified policy.

You can update only the rules and the display name for the policy.

To update a policy, you should use a read-modify-write loop:

Use GetPolicy to read the current version of the policy.

Modify the policy as needed.

Use UpdatePolicy to write the updated policy.

This pattern helps prevent conflicts between concurrent updates.

Example

  package 
  
 main 
 import 
  
 ( 
  
 "context" 
  
 iam 
  
 "cloud.google.com/go/iam/apiv2" 
  
 iampb 
  
 "google.golang.org/genproto/googleapis/iam/v2" 
 ) 
 func 
  
 main 
 () 
  
 { 
  
 ctx 
  
 := 
  
 context 
 . 
 Background 
 () 
  
 // This snippet has been automatically generated and should be regarded as a code template only. 
  
 // It will require modifications to work: 
  
 // - It may require correct/in-range values for request initialization. 
  
 // - It may require specifying regional endpoints when creating the service client as shown in: 
  
 //   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options 
  
 c 
 , 
  
 err 
  
 := 
  
 iam 
 . 
 NewPoliciesClient 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 defer 
  
 c 
 . 
  Close 
 
 () 
  
 req 
  
 := 
  
& iampb 
 . 
  UpdatePolicyRequest 
 
 { 
  
 // TODO: Fill request struct fields. 
  
 // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v2#UpdatePolicyRequest. 
  
 } 
  
 op 
 , 
  
 err 
  
 := 
  
 c 
 . 
 UpdatePolicy 
 ( 
 ctx 
 , 
  
 req 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 resp 
 , 
  
 err 
  
 := 
  
 op 
 . 
 Wait 
 ( 
 ctx 
 ) 
  
 if 
  
 err 
  
 != 
  
 nil 
  
 { 
  
 // TODO: Handle error. 
  
 } 
  
 // TODO: Use resp. 
  
 _ 
  
 = 
  
 resp 
 } 
 

func (*PoliciesClient) UpdatePolicyOperation

  func 
  
 ( 
 c 
  
 * 
  PoliciesClient 
 
 ) 
  
 UpdatePolicyOperation 
 ( 
 name 
  
  string 
 
 ) 
  
 * 
  UpdatePolicyOperation 
 
 

UpdatePolicyOperation returns a new UpdatePolicyOperation from a given name. The name must be that of a previously created UpdatePolicyOperation, possibly from a different process.

PolicyIterator

  type 
  
 PolicyIterator 
  
 struct 
  
 { 
  
 // Response is the raw response for the current page. 
  
 // It must be cast to the RPC response type. 
  
 // Calling Next() or InternalFetch() updates this value. 
  
 Response 
  
 interface 
 {} 
  
 // InternalFetch is for use by the Google Cloud Libraries only. 
  
 // It is not part of the stable interface of this package. 
  
 // 
  
 // InternalFetch returns results from a single call to the underlying RPC. 
  
 // The number of results is no greater than pageSize. 
  
 // If there are no more results, nextPageToken is empty and err is nil. 
  
 InternalFetch 
  
 func 
 ( 
 pageSize 
  
  int 
 
 , 
  
 pageToken 
  
  string 
 
 ) 
  
 ( 
 results 
  
 [] 
 * 
  iampb 
 
 . 
  Policy 
 
 , 
  
 nextPageToken 
  
  string 
 
 , 
  
 err 
  
  error 
 
 ) 
  
 // contains filtered or unexported fields 
 } 
 

PolicyIterator manages a stream of *iampb.Policy.

func (*PolicyIterator) Next

  func 
  
 ( 
 it 
  
 * 
  PolicyIterator 
 
 ) 
  
 Next 
 () 
  
 ( 
 * 
  iampb 
 
 . 
  Policy 
 
 , 
  
  error 
 
 ) 
 

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*PolicyIterator) PageInfo

  func 
  
 ( 
 it 
  
 * 
  PolicyIterator 
 
 ) 
  
 PageInfo 
 () 
  
 * 
  iterator 
 
 . 
  PageInfo 
 
 

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

UpdatePolicyOperation

  type 
  
 UpdatePolicyOperation 
  
 struct 
  
 { 
  
 // contains filtered or unexported fields 
 } 
 

UpdatePolicyOperation manages a long-running operation from UpdatePolicy.

func (*UpdatePolicyOperation) Done

  func 
  
 ( 
 op 
  
 * 
  UpdatePolicyOperation 
 
 ) 
  
 Done 
 () 
  
  bool 
 
 

Done reports whether the long-running operation has completed.

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*UpdatePolicyOperation) Name

  func 
  
 ( 
 op 
  
 * 
  UpdatePolicyOperation 
 
 ) 
  
 Name 
 () 
  
  string 
 
 

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*UpdatePolicyOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*UpdatePolicyOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

Create a Mobile Website
View Site in Mobile | Classic
Share by: