Package iam is an auto-generated package for the Identity and Access Management (IAM) API.
Manages identity and access control for Google Cloud resources, including the creation of service accounts, which you can use to authenticate to Google and make API calls. Enabling this API also enables the IAM Service Account Credentials API (iamcredentials.googleapis.com (at http://iamcredentials.googleapis.com)). However, disabling this API doesn’t disable the IAM Service Account Credentials API.
NOTE: This package is in beta. It is not stable, and may be subject to changes.
General documentation
For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/iam/apiv3@latest 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.NewPolicyBindingsClient(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, mentioned above.
req := &iampb.CreatePolicyBindingRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#CreatePolicyBindingRequest. } op, err := c.CreatePolicyBinding(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewPolicyBindingsClient 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.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
CreatePolicyBindingOperation
type CreatePolicyBindingOperation struct {
// contains filtered or unexported fields
}
CreatePolicyBindingOperation manages a long-running operation from CreatePolicyBinding.
func (*CreatePolicyBindingOperation) Done
func (op *CreatePolicyBindingOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreatePolicyBindingOperation) Metadata
func (op *CreatePolicyBindingOperation) Metadata() (*iampb.OperationMetadata, error)
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 (*CreatePolicyBindingOperation) Name
func (op *CreatePolicyBindingOperation) 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 (*CreatePolicyBindingOperation) Poll
func (op *CreatePolicyBindingOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*iampb.PolicyBinding, error)
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 (*CreatePolicyBindingOperation) Wait
func (op *CreatePolicyBindingOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*iampb.PolicyBinding, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
CreatePrincipalAccessBoundaryPolicyOperation
type CreatePrincipalAccessBoundaryPolicyOperation struct {
// contains filtered or unexported fields
}
CreatePrincipalAccessBoundaryPolicyOperation manages a long-running operation from CreatePrincipalAccessBoundaryPolicy.
func (*CreatePrincipalAccessBoundaryPolicyOperation) Done
func (op *CreatePrincipalAccessBoundaryPolicyOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreatePrincipalAccessBoundaryPolicyOperation) Metadata
func (op *CreatePrincipalAccessBoundaryPolicyOperation) Metadata() (*iampb.OperationMetadata, error)
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 (*CreatePrincipalAccessBoundaryPolicyOperation) Name
func (op *CreatePrincipalAccessBoundaryPolicyOperation) 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 (*CreatePrincipalAccessBoundaryPolicyOperation) Poll
func (op *CreatePrincipalAccessBoundaryPolicyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*iampb.PrincipalAccessBoundaryPolicy, error)
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 (*CreatePrincipalAccessBoundaryPolicyOperation) Wait
func (op *CreatePrincipalAccessBoundaryPolicyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*iampb.PrincipalAccessBoundaryPolicy, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeletePolicyBindingOperation
type DeletePolicyBindingOperation struct {
// contains filtered or unexported fields
}
DeletePolicyBindingOperation manages a long-running operation from DeletePolicyBinding.
func (*DeletePolicyBindingOperation) Done
func (op *DeletePolicyBindingOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeletePolicyBindingOperation) Metadata
func (op *DeletePolicyBindingOperation) Metadata() (*iampb.OperationMetadata, error)
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 (*DeletePolicyBindingOperation) Name
func (op *DeletePolicyBindingOperation) 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 (*DeletePolicyBindingOperation) Poll
func (op *DeletePolicyBindingOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
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 (*DeletePolicyBindingOperation) Wait
func (op *DeletePolicyBindingOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeletePrincipalAccessBoundaryPolicyOperation
type DeletePrincipalAccessBoundaryPolicyOperation struct {
// contains filtered or unexported fields
}
DeletePrincipalAccessBoundaryPolicyOperation manages a long-running operation from DeletePrincipalAccessBoundaryPolicy.
func (*DeletePrincipalAccessBoundaryPolicyOperation) Done
func (op *DeletePrincipalAccessBoundaryPolicyOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeletePrincipalAccessBoundaryPolicyOperation) Metadata
func (op *DeletePrincipalAccessBoundaryPolicyOperation) Metadata() (*iampb.OperationMetadata, error)
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 (*DeletePrincipalAccessBoundaryPolicyOperation) Name
func (op *DeletePrincipalAccessBoundaryPolicyOperation) 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 (*DeletePrincipalAccessBoundaryPolicyOperation) Poll
func (op *DeletePrincipalAccessBoundaryPolicyOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
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 (*DeletePrincipalAccessBoundaryPolicyOperation) Wait
func (op *DeletePrincipalAccessBoundaryPolicyOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
PolicyBindingIterator
type PolicyBindingIterator 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.PolicyBinding, nextPageToken string, err error)
// contains filtered or unexported fields
}
PolicyBindingIterator manages a stream of *iampb.PolicyBinding.
func (*PolicyBindingIterator) All
func (it *PolicyBindingIterator) All() iter.Seq2[*iampb.PolicyBinding, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*PolicyBindingIterator) Next
func (it *PolicyBindingIterator) Next() (*iampb.PolicyBinding, 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 (*PolicyBindingIterator) PageInfo
func (it *PolicyBindingIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
PolicyBindingsCallOptions
type PolicyBindingsCallOptions struct {
CreatePolicyBinding []gax.CallOption
GetPolicyBinding []gax.CallOption
UpdatePolicyBinding []gax.CallOption
DeletePolicyBinding []gax.CallOption
ListPolicyBindings []gax.CallOption
SearchTargetPolicyBindings []gax.CallOption
GetOperation []gax.CallOption
}
PolicyBindingsCallOptions contains the retry settings for each method of PolicyBindingsClient.
PolicyBindingsClient
type PolicyBindingsClient struct {
// The call options for this service.
CallOptions *PolicyBindingsCallOptions
// 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
}
PolicyBindingsClient 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) policy bindings.
func NewPolicyBindingsClient
func NewPolicyBindingsClient(ctx context.Context, opts ...option.ClientOption) (*PolicyBindingsClient, error)
NewPolicyBindingsClient creates a new policy bindings 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) policy bindings.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
)
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.NewPolicyBindingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewPolicyBindingsRESTClient
func NewPolicyBindingsRESTClient(ctx context.Context, opts ...option.ClientOption) (*PolicyBindingsClient, error)
NewPolicyBindingsRESTClient creates a new policy bindings rest client.
An interface for managing Identity and Access Management (IAM) policy bindings.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
)
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.NewPolicyBindingsRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*PolicyBindingsClient) Close
func (c *PolicyBindingsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*PolicyBindingsClient) Connection (deprecated)
func (c *PolicyBindingsClient) 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 (*PolicyBindingsClient) CreatePolicyBinding
func (c *PolicyBindingsClient) CreatePolicyBinding(ctx context.Context, req *iampb.CreatePolicyBindingRequest, opts ...gax.CallOption) (*CreatePolicyBindingOperation, error)
CreatePolicyBinding creates a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is created, the policy is applied to the target.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
)
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.NewPolicyBindingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.CreatePolicyBindingRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#CreatePolicyBindingRequest.
}
op, err := c.CreatePolicyBinding(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*PolicyBindingsClient) CreatePolicyBindingOperation
func (c *PolicyBindingsClient) CreatePolicyBindingOperation(name string) *CreatePolicyBindingOperation
CreatePolicyBindingOperation returns a new CreatePolicyBindingOperation from a given name. The name must be that of a previously created CreatePolicyBindingOperation, possibly from a different process.
func (*PolicyBindingsClient) DeletePolicyBinding
func (c *PolicyBindingsClient) DeletePolicyBinding(ctx context.Context, req *iampb.DeletePolicyBindingRequest, opts ...gax.CallOption) (*DeletePolicyBindingOperation, error)
DeletePolicyBinding deletes a policy binding and returns a long-running operation. Callers will need the IAM permissions on both the policy and target. Once the binding is deleted, the policy no longer applies to the target.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
)
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.NewPolicyBindingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.DeletePolicyBindingRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#DeletePolicyBindingRequest.
}
op, err := c.DeletePolicyBinding(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*PolicyBindingsClient) DeletePolicyBindingOperation
func (c *PolicyBindingsClient) DeletePolicyBindingOperation(name string) *DeletePolicyBindingOperation
DeletePolicyBindingOperation returns a new DeletePolicyBindingOperation from a given name. The name must be that of a previously created DeletePolicyBindingOperation, possibly from a different process.
func (*PolicyBindingsClient) GetOperation
func (c *PolicyBindingsClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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.NewPolicyBindingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*PolicyBindingsClient) GetPolicyBinding
func (c *PolicyBindingsClient) GetPolicyBinding(ctx context.Context, req *iampb.GetPolicyBindingRequest, opts ...gax.CallOption) (*iampb.PolicyBinding, error)
GetPolicyBinding gets a policy binding.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
)
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.NewPolicyBindingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.GetPolicyBindingRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#GetPolicyBindingRequest.
}
resp, err := c.GetPolicyBinding(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*PolicyBindingsClient) ListPolicyBindings
func (c *PolicyBindingsClient) ListPolicyBindings(ctx context.Context, req *iampb.ListPolicyBindingsRequest, opts ...gax.CallOption) *PolicyBindingIterator
ListPolicyBindings lists policy bindings.
Examples
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
"google.golang.org/api/iterator"
)
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.NewPolicyBindingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.ListPolicyBindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#ListPolicyBindingsRequest.
}
it := c.ListPolicyBindings(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*iampb.ListPolicyBindingsResponse)
}
}
all
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
)
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.NewPolicyBindingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.ListPolicyBindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#ListPolicyBindingsRequest.
}
for resp, err := range c.ListPolicyBindings(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*PolicyBindingsClient) SearchTargetPolicyBindings
func (c *PolicyBindingsClient) SearchTargetPolicyBindings(ctx context.Context, req *iampb.SearchTargetPolicyBindingsRequest, opts ...gax.CallOption) *PolicyBindingIterator
SearchTargetPolicyBindings search policy bindings by target. Returns all policy binding objects bound directly to target.
Examples
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
"google.golang.org/api/iterator"
)
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.NewPolicyBindingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.SearchTargetPolicyBindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#SearchTargetPolicyBindingsRequest.
}
it := c.SearchTargetPolicyBindings(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*iampb.SearchTargetPolicyBindingsResponse)
}
}
all
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
)
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.NewPolicyBindingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.SearchTargetPolicyBindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#SearchTargetPolicyBindingsRequest.
}
for resp, err := range c.SearchTargetPolicyBindings(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*PolicyBindingsClient) UpdatePolicyBinding
func (c *PolicyBindingsClient) UpdatePolicyBinding(ctx context.Context, req *iampb.UpdatePolicyBindingRequest, opts ...gax.CallOption) (*UpdatePolicyBindingOperation, error)
UpdatePolicyBinding updates a policy binding and returns a long-running operation. Callers will need the IAM permissions on the policy and target in the binding to update, and the IAM permission to remove the existing policy from the binding. Target is immutable and cannot be updated. Once the binding is updated, the new policy is applied to the target.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
)
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.NewPolicyBindingsClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.UpdatePolicyBindingRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#UpdatePolicyBindingRequest.
}
op, err := c.UpdatePolicyBinding(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*PolicyBindingsClient) UpdatePolicyBindingOperation
func (c *PolicyBindingsClient) UpdatePolicyBindingOperation(name string) *UpdatePolicyBindingOperation
UpdatePolicyBindingOperation returns a new UpdatePolicyBindingOperation from a given name. The name must be that of a previously created UpdatePolicyBindingOperation, possibly from a different process.
PrincipalAccessBoundaryPoliciesCallOptions
type PrincipalAccessBoundaryPoliciesCallOptions struct {
CreatePrincipalAccessBoundaryPolicy []gax.CallOption
GetPrincipalAccessBoundaryPolicy []gax.CallOption
UpdatePrincipalAccessBoundaryPolicy []gax.CallOption
DeletePrincipalAccessBoundaryPolicy []gax.CallOption
ListPrincipalAccessBoundaryPolicies []gax.CallOption
SearchPrincipalAccessBoundaryPolicyBindings []gax.CallOption
GetOperation []gax.CallOption
}
PrincipalAccessBoundaryPoliciesCallOptions contains the retry settings for each method of PrincipalAccessBoundaryPoliciesClient.
PrincipalAccessBoundaryPoliciesClient
type PrincipalAccessBoundaryPoliciesClient struct {
// The call options for this service.
CallOptions *PrincipalAccessBoundaryPoliciesCallOptions
// 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
}
PrincipalAccessBoundaryPoliciesClient 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.
Manages Identity and Access Management (IAM) principal access boundary policies.
func NewPrincipalAccessBoundaryPoliciesClient
func NewPrincipalAccessBoundaryPoliciesClient(ctx context.Context, opts ...option.ClientOption) (*PrincipalAccessBoundaryPoliciesClient, error)
NewPrincipalAccessBoundaryPoliciesClient creates a new principal access boundary policies client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Manages Identity and Access Management (IAM) principal access boundary policies.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
)
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.NewPrincipalAccessBoundaryPoliciesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewPrincipalAccessBoundaryPoliciesRESTClient
func NewPrincipalAccessBoundaryPoliciesRESTClient(ctx context.Context, opts ...option.ClientOption) (*PrincipalAccessBoundaryPoliciesClient, error)
NewPrincipalAccessBoundaryPoliciesRESTClient creates a new principal access boundary policies rest client.
Manages Identity and Access Management (IAM) principal access boundary policies.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
)
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.NewPrincipalAccessBoundaryPoliciesRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*PrincipalAccessBoundaryPoliciesClient) Close
func (c *PrincipalAccessBoundaryPoliciesClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*PrincipalAccessBoundaryPoliciesClient) Connection (deprecated)
func (c *PrincipalAccessBoundaryPoliciesClient) 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 (*PrincipalAccessBoundaryPoliciesClient) CreatePrincipalAccessBoundaryPolicy
func (c *PrincipalAccessBoundaryPoliciesClient) CreatePrincipalAccessBoundaryPolicy(ctx context.Context, req *iampb.CreatePrincipalAccessBoundaryPolicyRequest, opts ...gax.CallOption) (*CreatePrincipalAccessBoundaryPolicyOperation, error)
CreatePrincipalAccessBoundaryPolicy creates a principal access boundary policy, and returns a long running operation.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
)
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.NewPrincipalAccessBoundaryPoliciesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.CreatePrincipalAccessBoundaryPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#CreatePrincipalAccessBoundaryPolicyRequest.
}
op, err := c.CreatePrincipalAccessBoundaryPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*PrincipalAccessBoundaryPoliciesClient) CreatePrincipalAccessBoundaryPolicyOperation
func (c *PrincipalAccessBoundaryPoliciesClient) CreatePrincipalAccessBoundaryPolicyOperation(name string) *CreatePrincipalAccessBoundaryPolicyOperation
CreatePrincipalAccessBoundaryPolicyOperation returns a new CreatePrincipalAccessBoundaryPolicyOperation from a given name. The name must be that of a previously created CreatePrincipalAccessBoundaryPolicyOperation, possibly from a different process.
func (*PrincipalAccessBoundaryPoliciesClient) DeletePrincipalAccessBoundaryPolicy
func (c *PrincipalAccessBoundaryPoliciesClient) DeletePrincipalAccessBoundaryPolicy(ctx context.Context, req *iampb.DeletePrincipalAccessBoundaryPolicyRequest, opts ...gax.CallOption) (*DeletePrincipalAccessBoundaryPolicyOperation, error)
DeletePrincipalAccessBoundaryPolicy deletes a principal access boundary policy.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
)
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.NewPrincipalAccessBoundaryPoliciesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.DeletePrincipalAccessBoundaryPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#DeletePrincipalAccessBoundaryPolicyRequest.
}
op, err := c.DeletePrincipalAccessBoundaryPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*PrincipalAccessBoundaryPoliciesClient) DeletePrincipalAccessBoundaryPolicyOperation
func (c *PrincipalAccessBoundaryPoliciesClient) DeletePrincipalAccessBoundaryPolicyOperation(name string) *DeletePrincipalAccessBoundaryPolicyOperation
DeletePrincipalAccessBoundaryPolicyOperation returns a new DeletePrincipalAccessBoundaryPolicyOperation from a given name. The name must be that of a previously created DeletePrincipalAccessBoundaryPolicyOperation, possibly from a different process.
func (*PrincipalAccessBoundaryPoliciesClient) GetOperation
func (c *PrincipalAccessBoundaryPoliciesClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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.NewPrincipalAccessBoundaryPoliciesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*PrincipalAccessBoundaryPoliciesClient) GetPrincipalAccessBoundaryPolicy
func (c *PrincipalAccessBoundaryPoliciesClient) GetPrincipalAccessBoundaryPolicy(ctx context.Context, req *iampb.GetPrincipalAccessBoundaryPolicyRequest, opts ...gax.CallOption) (*iampb.PrincipalAccessBoundaryPolicy, error)
GetPrincipalAccessBoundaryPolicy gets a principal access boundary policy.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
)
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.NewPrincipalAccessBoundaryPoliciesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.GetPrincipalAccessBoundaryPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#GetPrincipalAccessBoundaryPolicyRequest.
}
resp, err := c.GetPrincipalAccessBoundaryPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*PrincipalAccessBoundaryPoliciesClient) ListPrincipalAccessBoundaryPolicies
func (c *PrincipalAccessBoundaryPoliciesClient) ListPrincipalAccessBoundaryPolicies(ctx context.Context, req *iampb.ListPrincipalAccessBoundaryPoliciesRequest, opts ...gax.CallOption) *PrincipalAccessBoundaryPolicyIterator
ListPrincipalAccessBoundaryPolicies lists principal access boundary policies.
Examples
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
"google.golang.org/api/iterator"
)
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.NewPrincipalAccessBoundaryPoliciesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.ListPrincipalAccessBoundaryPoliciesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#ListPrincipalAccessBoundaryPoliciesRequest.
}
it := c.ListPrincipalAccessBoundaryPolicies(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*iampb.ListPrincipalAccessBoundaryPoliciesResponse)
}
}
all
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
)
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.NewPrincipalAccessBoundaryPoliciesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.ListPrincipalAccessBoundaryPoliciesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#ListPrincipalAccessBoundaryPoliciesRequest.
}
for resp, err := range c.ListPrincipalAccessBoundaryPolicies(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*PrincipalAccessBoundaryPoliciesClient) SearchPrincipalAccessBoundaryPolicyBindings
func (c *PrincipalAccessBoundaryPoliciesClient) SearchPrincipalAccessBoundaryPolicyBindings(ctx context.Context, req *iampb.SearchPrincipalAccessBoundaryPolicyBindingsRequest, opts ...gax.CallOption) *PolicyBindingIterator
SearchPrincipalAccessBoundaryPolicyBindings returns all policy bindings that bind a specific policy if a user has searchPolicyBindings permission on that policy.
Examples
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
"google.golang.org/api/iterator"
)
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.NewPrincipalAccessBoundaryPoliciesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.SearchPrincipalAccessBoundaryPolicyBindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#SearchPrincipalAccessBoundaryPolicyBindingsRequest.
}
it := c.SearchPrincipalAccessBoundaryPolicyBindings(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
// If you need to access the underlying RPC response,
// you can do so by casting the `Response` as below.
// Otherwise, remove this line. Only populated after
// first call to Next(). Not safe for concurrent access.
_ = it.Response.(*iampb.SearchPrincipalAccessBoundaryPolicyBindingsResponse)
}
}
all
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
)
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.NewPrincipalAccessBoundaryPoliciesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.SearchPrincipalAccessBoundaryPolicyBindingsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#SearchPrincipalAccessBoundaryPolicyBindingsRequest.
}
for resp, err := range c.SearchPrincipalAccessBoundaryPolicyBindings(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*PrincipalAccessBoundaryPoliciesClient) UpdatePrincipalAccessBoundaryPolicy
func (c *PrincipalAccessBoundaryPoliciesClient) UpdatePrincipalAccessBoundaryPolicy(ctx context.Context, req *iampb.UpdatePrincipalAccessBoundaryPolicyRequest, opts ...gax.CallOption) (*UpdatePrincipalAccessBoundaryPolicyOperation, error)
UpdatePrincipalAccessBoundaryPolicy updates a principal access boundary policy.
Example
package main
import (
"context"
iam "cloud.google.com/go/iam/apiv3"
iampb "cloud.google.com/go/iam/apiv3/iampb"
)
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.NewPrincipalAccessBoundaryPoliciesClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.UpdatePrincipalAccessBoundaryPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv3/iampb#UpdatePrincipalAccessBoundaryPolicyRequest.
}
op, err := c.UpdatePrincipalAccessBoundaryPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*PrincipalAccessBoundaryPoliciesClient) UpdatePrincipalAccessBoundaryPolicyOperation
func (c *PrincipalAccessBoundaryPoliciesClient) UpdatePrincipalAccessBoundaryPolicyOperation(name string) *UpdatePrincipalAccessBoundaryPolicyOperation
UpdatePrincipalAccessBoundaryPolicyOperation returns a new UpdatePrincipalAccessBoundaryPolicyOperation from a given name. The name must be that of a previously created UpdatePrincipalAccessBoundaryPolicyOperation, possibly from a different process.
PrincipalAccessBoundaryPolicyIterator
type PrincipalAccessBoundaryPolicyIterator 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.PrincipalAccessBoundaryPolicy, nextPageToken string, err error)
// contains filtered or unexported fields
}
PrincipalAccessBoundaryPolicyIterator manages a stream of *iampb.PrincipalAccessBoundaryPolicy.
func (*PrincipalAccessBoundaryPolicyIterator) All
func (it *PrincipalAccessBoundaryPolicyIterator) All() iter.Seq2[*iampb.PrincipalAccessBoundaryPolicy, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*PrincipalAccessBoundaryPolicyIterator) Next
func (it *PrincipalAccessBoundaryPolicyIterator) Next() (*iampb.PrincipalAccessBoundaryPolicy, 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 (*PrincipalAccessBoundaryPolicyIterator) PageInfo
func (it *PrincipalAccessBoundaryPolicyIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
UpdatePolicyBindingOperation
type UpdatePolicyBindingOperation struct {
// contains filtered or unexported fields
}
UpdatePolicyBindingOperation manages a long-running operation from UpdatePolicyBinding.
func (*UpdatePolicyBindingOperation) Done
func (op *UpdatePolicyBindingOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdatePolicyBindingOperation) Metadata
func (op *UpdatePolicyBindingOperation) Metadata() (*iampb.OperationMetadata, error)
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 (*UpdatePolicyBindingOperation) Name
func (op *UpdatePolicyBindingOperation) 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 (*UpdatePolicyBindingOperation) Poll
func (op *UpdatePolicyBindingOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*iampb.PolicyBinding, error)
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 (*UpdatePolicyBindingOperation) Wait
func (op *UpdatePolicyBindingOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*iampb.PolicyBinding, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
UpdatePrincipalAccessBoundaryPolicyOperation
type UpdatePrincipalAccessBoundaryPolicyOperation struct {
// contains filtered or unexported fields
}
UpdatePrincipalAccessBoundaryPolicyOperation manages a long-running operation from UpdatePrincipalAccessBoundaryPolicy.
func (*UpdatePrincipalAccessBoundaryPolicyOperation) Done
func (op *UpdatePrincipalAccessBoundaryPolicyOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdatePrincipalAccessBoundaryPolicyOperation) Metadata
func (op *UpdatePrincipalAccessBoundaryPolicyOperation) Metadata() (*iampb.OperationMetadata, error)
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 (*UpdatePrincipalAccessBoundaryPolicyOperation) Name
func (op *UpdatePrincipalAccessBoundaryPolicyOperation) 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 (*UpdatePrincipalAccessBoundaryPolicyOperation) Poll
func (op *UpdatePrincipalAccessBoundaryPolicyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*iampb.PrincipalAccessBoundaryPolicy, error)
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 (*UpdatePrincipalAccessBoundaryPolicyOperation) Wait
func (op *UpdatePrincipalAccessBoundaryPolicyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*iampb.PrincipalAccessBoundaryPolicy, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.