Privileged Access Manager API v1 - Package cloud.google.com/go/privilegedaccessmanager/apiv1 (v0.3.1) Stay organized with collections Save and categorize content based on your preferences.
Beta
This library is covered by thePre-GA Offerings Terms of the Terms of Service. Pre-GA libraries might have limited support, and changes to pre-GA libraries might not be compatible with other pre-GA versions. For more information, see thelaunch stage descriptions.
Note: To get more information about this package, such as access to older versions, viewthis package on pkg.go.dev.Package privilegedaccessmanager is an auto-generated package for thePrivileged Access Manager API.
Privileged Access Manager (PAM) helps you on your journey towards leastprivilege and helps mitigate risks tied to privileged access misuse orabuse. PAM allows you to shift from always-on standing privileges towardson-demand access with just-in-time, time-bound, and approval-based accesselevations. PAM allows IAM administrators to create entitlements that cangrant just-in-time, temporary access to any resource scope. Requesters canexplore eligible entitlements and request the access needed for theirtask. Approvers are notified when approvals await their decision.Streamlined workflows facilitated by using PAM can support various usecases, including emergency access for incident responders, time-boxedaccess for developers for critical deployment or maintenance, temporaryaccess for operators for data ingestion and audits, JIT access to serviceaccounts for automated tasks, and more.
NOTE:Thispackageisinbeta.Itisnotstable,andmaybesubjecttochanges.
General documentation
For information that is relevant for all client libraries please referencehttps://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on thispage 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/privilegedaccessmanager/apiv1@latestctx:=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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.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:=&privilegedaccessmanagerpb.ApproveGrantRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#ApproveGrantRequest.}resp,err:=c.ApproveGrant(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp
Use of Context
The ctx passed to NewClient is used for authentication requests andfor 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
funcDefaultAuthScopes()[]stringDefaultAuthScopes reports the default set of authentication scopes to use with this package.
CallOptions
typeCallOptionsstruct{CheckOnboardingStatus[]gax.CallOptionListEntitlements[]gax.CallOptionSearchEntitlements[]gax.CallOptionGetEntitlement[]gax.CallOptionCreateEntitlement[]gax.CallOptionDeleteEntitlement[]gax.CallOptionUpdateEntitlement[]gax.CallOptionListGrants[]gax.CallOptionSearchGrants[]gax.CallOptionGetGrant[]gax.CallOptionCreateGrant[]gax.CallOptionApproveGrant[]gax.CallOptionDenyGrant[]gax.CallOptionRevokeGrant[]gax.CallOptionGetLocation[]gax.CallOptionListLocations[]gax.CallOptionDeleteOperation[]gax.CallOptionGetOperation[]gax.CallOptionListOperations[]gax.CallOption}CallOptions contains the retry settings for each method of Client.
Client
typeClientstruct{// The call options for this service.CallOptions*CallOptions// 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}Client is a client for interacting with Privileged Access Manager API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
This API allows customers to manage temporary, request based privilegedaccess to their resources.
It defines the following resource model:
A collection of Entitlement resources. An entitlement allows configuring(among other things): Some kind of privileged access that users can request. A set of users called requesters who can request this access. A maximum duration for which the access can be requested. An optional approval workflow which must be satisfied before access is granted.A collection of Grant resources. A grant is a request by a requester toget the privileged access specified in an entitlement for some duration.After the approval workflow as specified in the entitlement is satisfied,
the specified access is given to the requester. The access is automaticallytaken back after the requested duration is over.func NewClient
NewClient creates a new privileged access manager client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
This API allows customers to manage temporary, request based privilegedaccess to their resources.
It defines the following resource model:
A collection of Entitlement resources. An entitlement allows configuring(among other things): Some kind of privileged access that users can request. A set of users called requesters who can request this access. A maximum duration for which the access can be requested. An optional approval workflow which must be satisfied before access is granted.A collection of Grant resources. A grant is a request by a requester toget the privileged access specified in an entitlement for some duration.After the approval workflow as specified in the entitlement is satisfied,
the specified access is given to the requester. The access is automaticallytaken back after the requested duration is over.Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewRESTClient
NewRESTClient creates a new privileged access manager rest client.
This API allows customers to manage temporary, request based privilegedaccess to their resources.
It defines the following resource model:
A collection of Entitlement resources. An entitlement allows configuring(among other things): Some kind of privileged access that users can request. A set of users called requesters who can request this access. A maximum duration for which the access can be requested. An optional approval workflow which must be satisfied before access is granted.A collection of Grant resources. A grant is a request by a requester toget the privileged access specified in an entitlement for some duration.After the approval workflow as specified in the entitlement is satisfied,
the specified access is given to the requester. The access is automaticallytaken back after the requested duration is over.Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*Client) ApproveGrant
func(c*Client)ApproveGrant(ctxcontext.Context,req*privilegedaccessmanagerpb.ApproveGrantRequest,opts...gax.CallOption)(*privilegedaccessmanagerpb.Grant,error)ApproveGrant ApproveGrant is used to approve a grant. This method can only be calledon a grant when it’s in the APPROVAL_AWAITED state. This operation can’tbe undone.
Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.ApproveGrantRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#ApproveGrantRequest.}resp,err:=c.ApproveGrant(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) CheckOnboardingStatus
func(c*Client)CheckOnboardingStatus(ctxcontext.Context,req*privilegedaccessmanagerpb.CheckOnboardingStatusRequest,opts...gax.CallOption)(*privilegedaccessmanagerpb.CheckOnboardingStatusResponse,error)CheckOnboardingStatus CheckOnboardingStatus reports the onboarding status for aproject/folder/organization. Any findings reported by this API need to befixed before PAM can be used on the resource.
Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.CheckOnboardingStatusRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#CheckOnboardingStatusRequest.}resp,err:=c.CheckOnboardingStatus(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) Close
Close closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*Client) Connection (deprecated)
func(c*Client)Connection()*grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not alwaysreturn the same resource.
func (*Client) CreateEntitlement
func(c*Client)CreateEntitlement(ctxcontext.Context,req*privilegedaccessmanagerpb.CreateEntitlementRequest,opts...gax.CallOption)(*CreateEntitlementOperation,error)CreateEntitlement creates a new entitlement in a given project/folder/organization andlocation.
Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.CreateEntitlementRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#CreateEntitlementRequest.}op,err:=c.CreateEntitlement(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) CreateEntitlementOperation
func(c*Client)CreateEntitlementOperation(namestring)*CreateEntitlementOperationCreateEntitlementOperation returns a new CreateEntitlementOperation from a given name.The name must be that of a previously created CreateEntitlementOperation, possibly from a different process.
func (*Client) CreateGrant
func(c*Client)CreateGrant(ctxcontext.Context,req*privilegedaccessmanagerpb.CreateGrantRequest,opts...gax.CallOption)(*privilegedaccessmanagerpb.Grant,error)CreateGrant creates a new grant in a given project/folder/organization andlocation.
Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.CreateGrantRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#CreateGrantRequest.}resp,err:=c.CreateGrant(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) DeleteEntitlement
func(c*Client)DeleteEntitlement(ctxcontext.Context,req*privilegedaccessmanagerpb.DeleteEntitlementRequest,opts...gax.CallOption)(*DeleteEntitlementOperation,error)DeleteEntitlement deletes a single entitlement. This method can only be called when thereare no in-progress (ACTIVE/ACTIVATING/REVOKING) grants under theentitlement.
Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.DeleteEntitlementRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#DeleteEntitlementRequest.}op,err:=c.DeleteEntitlement(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) DeleteEntitlementOperation
func(c*Client)DeleteEntitlementOperation(namestring)*DeleteEntitlementOperationDeleteEntitlementOperation returns a new DeleteEntitlementOperation from a given name.The name must be that of a previously created DeleteEntitlementOperation, possibly from a different process.
func (*Client) DeleteOperation
func(c*Client)DeleteOperation(ctxcontext.Context,req*longrunningpb.DeleteOperationRequest,opts...gax.CallOption)errorDeleteOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.DeleteOperationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.}err=c.DeleteOperation(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*Client) DenyGrant
func(c*Client)DenyGrant(ctxcontext.Context,req*privilegedaccessmanagerpb.DenyGrantRequest,opts...gax.CallOption)(*privilegedaccessmanagerpb.Grant,error)DenyGrant DenyGrant is used to deny a grant. This method can only be called on agrant when it’s in the APPROVAL_AWAITED state. This operation can’t beundone.
Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.DenyGrantRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#DenyGrantRequest.}resp,err:=c.DenyGrant(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) GetEntitlement
func(c*Client)GetEntitlement(ctxcontext.Context,req*privilegedaccessmanagerpb.GetEntitlementRequest,opts...gax.CallOption)(*privilegedaccessmanagerpb.Entitlement,error)GetEntitlement gets details of a single entitlement.
Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.GetEntitlementRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#GetEntitlementRequest.}resp,err:=c.GetEntitlement(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) GetGrant
func(c*Client)GetGrant(ctxcontext.Context,req*privilegedaccessmanagerpb.GetGrantRequest,opts...gax.CallOption)(*privilegedaccessmanagerpb.Grant,error)GetGrant get details of a single grant.
Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.GetGrantRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#GetGrantRequest.}resp,err:=c.GetGrant(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) GetLocation
func(c*Client)GetLocation(ctxcontext.Context,req*locationpb.GetLocationRequest,opts...gax.CallOption)(*locationpb.Location,error)GetLocation gets information about a location.
Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"locationpb"google.golang.org/genproto/googleapis/cloud/location")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&locationpb.GetLocationRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.}resp,err:=c.GetLocation(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) GetOperation
func(c*Client)GetOperation(ctxcontext.Context,req*longrunningpb.GetOperationRequest,opts...gax.CallOption)(*longrunningpb.Operation,error)GetOperation is a utility method from google.longrunning.Operations.
Example
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.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)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) ListEntitlements
func(c*Client)ListEntitlements(ctxcontext.Context,req*privilegedaccessmanagerpb.ListEntitlementsRequest,opts...gax.CallOption)*EntitlementIteratorListEntitlements lists entitlements in a given project/folder/organization and location.
Examples
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.ListEntitlementsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#ListEntitlementsRequest.}it:=c.ListEntitlements(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*privilegedaccessmanagerpb.ListEntitlementsResponse)}}all
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.ListEntitlementsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#ListEntitlementsRequest.}forresp,err:=rangec.ListEntitlements(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*Client) ListGrants
func(c*Client)ListGrants(ctxcontext.Context,req*privilegedaccessmanagerpb.ListGrantsRequest,opts...gax.CallOption)*GrantIteratorListGrants lists grants for a given entitlement.
Examples
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.ListGrantsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#ListGrantsRequest.}it:=c.ListGrants(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*privilegedaccessmanagerpb.ListGrantsResponse)}}all
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.ListGrantsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#ListGrantsRequest.}forresp,err:=rangec.ListGrants(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*Client) ListLocations
func(c*Client)ListLocations(ctxcontext.Context,req*locationpb.ListLocationsRequest,opts...gax.CallOption)*LocationIteratorListLocations lists information about the supported locations for this service.
Examples
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1""google.golang.org/api/iterator"locationpb"google.golang.org/genproto/googleapis/cloud/location")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&locationpb.ListLocationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.}it:=c.ListLocations(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*locationpb.ListLocationsResponse)}}all
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"locationpb"google.golang.org/genproto/googleapis/cloud/location")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&locationpb.ListLocationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.}forresp,err:=rangec.ListLocations(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*Client) ListOperations
func(c*Client)ListOperations(ctxcontext.Context,req*longrunningpb.ListOperationsRequest,opts...gax.CallOption)*OperationIteratorListOperations is a utility method from google.longrunning.Operations.
Examples
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}it:=c.ListOperations(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*longrunningpb.ListOperationsResponse)}}all
packagemainimport("context"longrunningpb"cloud.google.com/go/longrunning/autogen/longrunningpb"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&longrunningpb.ListOperationsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.}forresp,err:=rangec.ListOperations(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*Client) RevokeGrant
func(c*Client)RevokeGrant(ctxcontext.Context,req*privilegedaccessmanagerpb.RevokeGrantRequest,opts...gax.CallOption)(*RevokeGrantOperation,error)RevokeGrant RevokeGrant is used to immediately revoke access for a grant. This methodcan be called when the grant is in a non-terminal state.
Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.RevokeGrantRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#RevokeGrantRequest.}op,err:=c.RevokeGrant(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) RevokeGrantOperation
func(c*Client)RevokeGrantOperation(namestring)*RevokeGrantOperationRevokeGrantOperation returns a new RevokeGrantOperation from a given name.The name must be that of a previously created RevokeGrantOperation, possibly from a different process.
func (*Client) SearchEntitlements
func(c*Client)SearchEntitlements(ctxcontext.Context,req*privilegedaccessmanagerpb.SearchEntitlementsRequest,opts...gax.CallOption)*EntitlementIteratorSearchEntitlements SearchEntitlements returns entitlements on which the caller has thespecified access.
Examples
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.SearchEntitlementsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#SearchEntitlementsRequest.}it:=c.SearchEntitlements(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*privilegedaccessmanagerpb.SearchEntitlementsResponse)}}all
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.SearchEntitlementsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#SearchEntitlementsRequest.}forresp,err:=rangec.SearchEntitlements(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*Client) SearchGrants
func(c*Client)SearchGrants(ctxcontext.Context,req*privilegedaccessmanagerpb.SearchGrantsRequest,opts...gax.CallOption)*GrantIteratorSearchGrants SearchGrants returns grants that are related to the calling user in thespecified way.
Examples
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb""google.golang.org/api/iterator")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.SearchGrantsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#SearchGrantsRequest.}it:=c.SearchGrants(ctx,req)for{resp,err:=it.Next()iferr==iterator.Done{break}iferr!=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.(*privilegedaccessmanagerpb.SearchGrantsResponse)}}all
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.SearchGrantsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#SearchGrantsRequest.}forresp,err:=rangec.SearchGrants(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*Client) UpdateEntitlement
func(c*Client)UpdateEntitlement(ctxcontext.Context,req*privilegedaccessmanagerpb.UpdateEntitlementRequest,opts...gax.CallOption)(*UpdateEntitlementOperation,error)UpdateEntitlement updates the entitlement specified in the request. Updated fields in theentitlement need to be specified in an update mask. The changes made to anentitlement are applicable only on future grants of the entitlement.However, if new approvers are added or existing approvers are removed fromthe approval workflow, the changes are effective on existing grants.
The following fields are not supported for updates:
All immutable fieldsEntitlement nameResource nameResource typeAdding an approval workflow in an entitlement which previously had noapproval workflow.Deleting the approval workflow from an entitlement.Adding or deleting a step in the approval workflow (only one step issupported)Note that updates are allowed on the list of approvers in an approvalworkflow step.
Example
packagemainimport("context"privilegedaccessmanager"cloud.google.com/go/privilegedaccessmanager/apiv1"privilegedaccessmanagerpb"cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb")funcmain(){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_Optionsc,err:=privilegedaccessmanager.NewClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&privilegedaccessmanagerpb.UpdateEntitlementRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/privilegedaccessmanager/apiv1/privilegedaccessmanagerpb#UpdateEntitlementRequest.}op,err:=c.UpdateEntitlement(ctx,req)iferr!=nil{// TODO: Handle error.}resp,err:=op.Wait(ctx)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*Client) UpdateEntitlementOperation
func(c*Client)UpdateEntitlementOperation(namestring)*UpdateEntitlementOperationUpdateEntitlementOperation returns a new UpdateEntitlementOperation from a given name.The name must be that of a previously created UpdateEntitlementOperation, possibly from a different process.
CreateEntitlementOperation
typeCreateEntitlementOperationstruct{// contains filtered or unexported fields}CreateEntitlementOperation manages a long-running operation from CreateEntitlement.
func (*CreateEntitlementOperation) Done
func(op*CreateEntitlementOperation)Done()boolDone reports whether the long-running operation has completed.
func (*CreateEntitlementOperation) Metadata
func(op*CreateEntitlementOperation)Metadata()(*privilegedaccessmanagerpb.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 (*CreateEntitlementOperation) Name
func(op*CreateEntitlementOperation)Name()stringName 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 (*CreateEntitlementOperation) Poll
func(op*CreateEntitlementOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*privilegedaccessmanagerpb.Entitlement,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 andthe 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 (*CreateEntitlementOperation) Wait
func(op*CreateEntitlementOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*privilegedaccessmanagerpb.Entitlement,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.
DeleteEntitlementOperation
typeDeleteEntitlementOperationstruct{// contains filtered or unexported fields}DeleteEntitlementOperation manages a long-running operation from DeleteEntitlement.
func (*DeleteEntitlementOperation) Done
func(op*DeleteEntitlementOperation)Done()boolDone reports whether the long-running operation has completed.
func (*DeleteEntitlementOperation) Metadata
func(op*DeleteEntitlementOperation)Metadata()(*privilegedaccessmanagerpb.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 (*DeleteEntitlementOperation) Name
func(op*DeleteEntitlementOperation)Name()stringName 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 (*DeleteEntitlementOperation) Poll
func(op*DeleteEntitlementOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*privilegedaccessmanagerpb.Entitlement,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 andthe 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 (*DeleteEntitlementOperation) Wait
func(op*DeleteEntitlementOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*privilegedaccessmanagerpb.Entitlement,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.
EntitlementIterator
typeEntitlementIteratorstruct{// 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.Responseinterface{}// 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.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*privilegedaccessmanagerpb.Entitlement,nextPageTokenstring,errerror)// contains filtered or unexported fields}EntitlementIterator manages a stream of *privilegedaccessmanagerpb.Entitlement.
func (*EntitlementIterator) All
func(it*EntitlementIterator)All()iter.Seq2[*privilegedaccessmanagerpb.Entitlement,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*EntitlementIterator) Next
func(it*EntitlementIterator)Next()(*privilegedaccessmanagerpb.Entitlement,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*EntitlementIterator) PageInfo
func(it*EntitlementIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
GrantIterator
typeGrantIteratorstruct{// 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.Responseinterface{}// 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.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*privilegedaccessmanagerpb.Grant,nextPageTokenstring,errerror)// contains filtered or unexported fields}GrantIterator manages a stream of *privilegedaccessmanagerpb.Grant.
func (*GrantIterator) All
func(it*GrantIterator)All()iter.Seq2[*privilegedaccessmanagerpb.Grant,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*GrantIterator) Next
func(it*GrantIterator)Next()(*privilegedaccessmanagerpb.Grant,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*GrantIterator) PageInfo
func(it*GrantIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
LocationIterator
typeLocationIteratorstruct{// 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.Responseinterface{}// 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.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*locationpb.Location,nextPageTokenstring,errerror)// contains filtered or unexported fields}LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) All
func(it*LocationIterator)All()iter.Seq2[*locationpb.Location,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*LocationIterator) Next
func(it*LocationIterator)Next()(*locationpb.Location,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*LocationIterator) PageInfo
func(it*LocationIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
OperationIterator
typeOperationIteratorstruct{// 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.Responseinterface{}// 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.InternalFetchfunc(pageSizeint,pageTokenstring)(results[]*longrunningpb.Operation,nextPageTokenstring,errerror)// contains filtered or unexported fields}OperationIterator manages a stream of *longrunningpb.Operation.
func (*OperationIterator) All
func(it*OperationIterator)All()iter.Seq2[*longrunningpb.Operation,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*OperationIterator) Next
func(it*OperationIterator)Next()(*longrunningpb.Operation,error)Next returns the next result. Its second return value is iterator.Done if there are no moreresults. Once Next returns Done, all subsequent calls will return Done.
func (*OperationIterator) PageInfo
func(it*OperationIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
RevokeGrantOperation
typeRevokeGrantOperationstruct{// contains filtered or unexported fields}RevokeGrantOperation manages a long-running operation from RevokeGrant.
func (*RevokeGrantOperation) Done
func(op*RevokeGrantOperation)Done()boolDone reports whether the long-running operation has completed.
func (*RevokeGrantOperation) Metadata
func(op*RevokeGrantOperation)Metadata()(*privilegedaccessmanagerpb.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 (*RevokeGrantOperation) Name
func(op*RevokeGrantOperation)Name()stringName 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 (*RevokeGrantOperation) Poll
func(op*RevokeGrantOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*privilegedaccessmanagerpb.Grant,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 andthe 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 (*RevokeGrantOperation) Wait
func(op*RevokeGrantOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*privilegedaccessmanagerpb.Grant,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.
UpdateEntitlementOperation
typeUpdateEntitlementOperationstruct{// contains filtered or unexported fields}UpdateEntitlementOperation manages a long-running operation from UpdateEntitlement.
func (*UpdateEntitlementOperation) Done
func(op*UpdateEntitlementOperation)Done()boolDone reports whether the long-running operation has completed.
func (*UpdateEntitlementOperation) Metadata
func(op*UpdateEntitlementOperation)Metadata()(*privilegedaccessmanagerpb.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 (*UpdateEntitlementOperation) Name
func(op*UpdateEntitlementOperation)Name()stringName 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 (*UpdateEntitlementOperation) Poll
func(op*UpdateEntitlementOperation)Poll(ctxcontext.Context,opts...gax.CallOption)(*privilegedaccessmanagerpb.Entitlement,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 andthe 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 (*UpdateEntitlementOperation) Wait
func(op*UpdateEntitlementOperation)Wait(ctxcontext.Context,opts...gax.CallOption)(*privilegedaccessmanagerpb.Entitlement,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.
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-10-30 UTC.