func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
CreatePolicyOperation manages a long-running operation from CreatePolicy.
type CreatePolicyOperation struct {
// contains filtered or unexported fields
}
func (op *CreatePolicyOperation) Done() bool
Done reports whether the long-running operation has completed.
func (op *CreatePolicyOperation) Metadata() (*iampb.PolicyOperationMetadata, 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 (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 (op *CreatePolicyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*iampb.Policy, 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 (op *CreatePolicyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*iampb.Policy, 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.
DeletePolicyOperation manages a long-running operation from DeletePolicy.
type DeletePolicyOperation struct {
// contains filtered or unexported fields
}
func (op *DeletePolicyOperation) Done() bool
Done reports whether the long-running operation has completed.
func (op *DeletePolicyOperation) Metadata() (*iampb.PolicyOperationMetadata, 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 (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 (op *DeletePolicyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*iampb.Policy, 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 (op *DeletePolicyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*iampb.Policy, 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.
PoliciesCallOptions contains the retry settings for each method of PoliciesClient.
type PoliciesCallOptions struct { ListPolicies []gax.CallOption GetPolicy []gax.CallOption CreatePolicy []gax.CallOption UpdatePolicy []gax.CallOption DeletePolicy []gax.CallOption GetOperation []gax.CallOption }
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.
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 }
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
func NewPoliciesRESTClient(ctx context.Context, opts ...option.ClientOption) (*PoliciesClient, error)
NewPoliciesRESTClient creates a new policies rest client.
An interface for managing Identity and Access Management (IAM) policies.
▹ Example
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 (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 (c *PoliciesClient) CreatePolicy(ctx context.Context, req *iampb.CreatePolicyRequest, opts ...gax.CallOption) (*CreatePolicyOperation, error)
CreatePolicy creates a policy.
▹ Example
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 (c *PoliciesClient) DeletePolicy(ctx context.Context, req *iampb.DeletePolicyRequest, opts ...gax.CallOption) (*DeletePolicyOperation, error)
DeletePolicy deletes a policy. This action is permanent.
▹ Example
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 (c *PoliciesClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
▹ Example
func (c *PoliciesClient) GetPolicy(ctx context.Context, req *iampb.GetPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
GetPolicy gets a policy.
▹ Example
func (c *PoliciesClient) ListPolicies(ctx context.Context, req *iampb.ListPoliciesRequest, opts ...gax.CallOption) *PolicyIterator
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
func (c *PoliciesClient) UpdatePolicy(ctx context.Context, req *iampb.UpdatePolicyRequest, opts ...gax.CallOption) (*UpdatePolicyOperation, error)
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
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 manages a stream of *iampb.Policy.
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 }
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 (it *PolicyIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
UpdatePolicyOperation manages a long-running operation from UpdatePolicy.
type UpdatePolicyOperation struct {
// contains filtered or unexported fields
}
func (op *UpdatePolicyOperation) Done() bool
Done reports whether the long-running operation has completed.
func (op *UpdatePolicyOperation) Metadata() (*iampb.PolicyOperationMetadata, 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 (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 (op *UpdatePolicyOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*iampb.Policy, 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 (op *UpdatePolicyOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*iampb.Policy, 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.