Package agentidentity is an auto-generated package for the Agent Identity 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/agentidentity/apiv1@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 := agentidentity.NewAuthProviderClient(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 := &agentidentitypb.CreateAuthProviderRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#CreateAuthProviderRequest. } resp, err := c.CreateAuthProvider(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewAuthProviderClient 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() []stringDefaultAuthScopes reports the default set of authentication scopes to use with this package.
AccessSummaryIterator
type AccessSummaryIterator 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 []*agentidentitypb.AccessSummary, nextPageToken string, err error)
// contains filtered or unexported fields
}AccessSummaryIterator manages a stream of *agentidentitypb.AccessSummary.
func (*AccessSummaryIterator) All
func (it *AccessSummaryIterator) All() iter.Seq2[*agentidentitypb.AccessSummary, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AccessSummaryIterator) Next
func (it *AccessSummaryIterator) Next() (*agentidentitypb.AccessSummary, 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 (*AccessSummaryIterator) PageInfo
func (it *AccessSummaryIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
AuthProviderCallOptions
type AuthProviderCallOptions struct {
ListAuthProviders []gax.CallOption
GetAuthProvider []gax.CallOption
CreateAuthProvider []gax.CallOption
UpdateAuthProvider []gax.CallOption
DeleteAuthProvider []gax.CallOption
UndeleteAuthProvider []gax.CallOption
QueryAuthProviders []gax.CallOption
QueryWorkloads []gax.CallOption
ListAuthorizations []gax.CallOption
GetAuthorization []gax.CallOption
DeleteAuthorization []gax.CallOption
ListAccessSummaries []gax.CallOption
GetAccessSummary []gax.CallOption
RevokeAuthorization []gax.CallOption
EnableAuthProvider []gax.CallOption
DisableAuthProvider []gax.CallOption
GetLocation []gax.CallOption
ListLocations []gax.CallOption
GetIamPolicy []gax.CallOption
SetIamPolicy []gax.CallOption
TestIamPermissions []gax.CallOption
}AuthProviderCallOptions contains the retry settings for each method of AuthProviderClient.
AuthProviderClient
type AuthProviderClient struct {
// The call options for this service.
CallOptions *AuthProviderCallOptions
// contains filtered or unexported fields
}AuthProviderClient is a client for interacting with Agent Identity API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Service describing handlers for resources
func NewAuthProviderClient
func NewAuthProviderClient(ctx context.Context, opts ...option.ClientOption) (*AuthProviderClient, error)NewAuthProviderClient creates a new auth provider service client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Service describing handlers for resources
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewAuthProviderRESTClient
func NewAuthProviderRESTClient(ctx context.Context, opts ...option.ClientOption) (*AuthProviderClient, error)NewAuthProviderRESTClient creates a new auth provider service rest client.
Service describing handlers for resources
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
)
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 := agentidentity.NewAuthProviderRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*AuthProviderClient) Close
func (c *AuthProviderClient) Close() errorClose closes the connection to the API service. Always call Close() when the client is no longer required.
func (*AuthProviderClient) Connection (deprecated)
func (c *AuthProviderClient) Connection() *grpc.ClientConnConnection returns a connection to the API service.
Deprecated: Connections are now pooled so this method does not always return the same resource.
func (*AuthProviderClient) CreateAuthProvider
func (c *AuthProviderClient) CreateAuthProvider(ctx context.Context, req *agentidentitypb.CreateAuthProviderRequest, opts ...gax.CallOption) (*agentidentitypb.AuthProvider, error)CreateAuthProvider creates a new AuthProvider in a given project and location.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.CreateAuthProviderRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#CreateAuthProviderRequest.
}
resp, err := c.CreateAuthProvider(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AuthProviderClient) DeleteAuthProvider
func (c *AuthProviderClient) DeleteAuthProvider(ctx context.Context, req *agentidentitypb.DeleteAuthProviderRequest, opts ...gax.CallOption) errorDeleteAuthProvider deletes a single AuthProvider.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.DeleteAuthProviderRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#DeleteAuthProviderRequest.
}
err = c.DeleteAuthProvider(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*AuthProviderClient) DeleteAuthorization
func (c *AuthProviderClient) DeleteAuthorization(ctx context.Context, req *agentidentitypb.DeleteAuthorizationRequest, opts ...gax.CallOption) errorDeleteAuthorization deletes a single Authorization.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.DeleteAuthorizationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#DeleteAuthorizationRequest.
}
err = c.DeleteAuthorization(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*AuthProviderClient) DisableAuthProvider
func (c *AuthProviderClient) DisableAuthProvider(ctx context.Context, req *agentidentitypb.DisableAuthProviderRequest, opts ...gax.CallOption) (*agentidentitypb.AuthProvider, error)DisableAuthProvider disables a single AuthProvider.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.DisableAuthProviderRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#DisableAuthProviderRequest.
}
resp, err := c.DisableAuthProvider(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AuthProviderClient) EnableAuthProvider
func (c *AuthProviderClient) EnableAuthProvider(ctx context.Context, req *agentidentitypb.EnableAuthProviderRequest, opts ...gax.CallOption) (*agentidentitypb.AuthProvider, error)EnableAuthProvider enables a single AuthProvider.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.EnableAuthProviderRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#EnableAuthProviderRequest.
}
resp, err := c.EnableAuthProvider(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AuthProviderClient) GetAccessSummary
func (c *AuthProviderClient) GetAccessSummary(ctx context.Context, req *agentidentitypb.GetAccessSummaryRequest, opts ...gax.CallOption) (*agentidentitypb.AccessSummary, error)GetAccessSummary gets details of a single AccessSummary.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.GetAccessSummaryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#GetAccessSummaryRequest.
}
resp, err := c.GetAccessSummary(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AuthProviderClient) GetAuthProvider
func (c *AuthProviderClient) GetAuthProvider(ctx context.Context, req *agentidentitypb.GetAuthProviderRequest, opts ...gax.CallOption) (*agentidentitypb.AuthProvider, error)GetAuthProvider gets details of a single AuthProvider.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.GetAuthProviderRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#GetAuthProviderRequest.
}
resp, err := c.GetAuthProvider(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AuthProviderClient) GetAuthorization
func (c *AuthProviderClient) GetAuthorization(ctx context.Context, req *agentidentitypb.GetAuthorizationRequest, opts ...gax.CallOption) (*agentidentitypb.Authorization, error)GetAuthorization gets details of a single Authorization.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.GetAuthorizationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#GetAuthorizationRequest.
}
resp, err := c.GetAuthorization(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AuthProviderClient) GetIamPolicy
func (c *AuthProviderClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)GetIamPolicy gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
iampb "cloud.google.com/go/iam/apiv1/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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.GetIamPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
}
resp, err := c.GetIamPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AuthProviderClient) GetLocation
func (c *AuthProviderClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)GetLocation gets information about a location.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AuthProviderClient) ListAccessSummaries
func (c *AuthProviderClient) ListAccessSummaries(ctx context.Context, req *agentidentitypb.ListAccessSummariesRequest, opts ...gax.CallOption) *AccessSummaryIteratorListAccessSummaries lists AccessSummaries in a given project and location. Supported Filters:
workload_id: Filter by the SPIFFE ID of the agent.
Example: workload_id="spiffe://example.com/ns/default/sa/my-agent"
Examples
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
"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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.ListAccessSummariesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#ListAccessSummariesRequest.
}
it := c.ListAccessSummaries(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.(*agentidentitypb.ListAccessSummariesResponse)
}
}
all
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.ListAccessSummariesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#ListAccessSummariesRequest.
}
for resp, err := range c.ListAccessSummaries(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*AuthProviderClient) ListAuthProviders
func (c *AuthProviderClient) ListAuthProviders(ctx context.Context, req *agentidentitypb.ListAuthProvidersRequest, opts ...gax.CallOption) *AuthProviderIteratorListAuthProviders lists AuthProviders in a given project and location.
Examples
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
"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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.ListAuthProvidersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#ListAuthProvidersRequest.
}
it := c.ListAuthProviders(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.(*agentidentitypb.ListAuthProvidersResponse)
}
}
all
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.ListAuthProvidersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#ListAuthProvidersRequest.
}
for resp, err := range c.ListAuthProviders(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*AuthProviderClient) ListAuthorizations
func (c *AuthProviderClient) ListAuthorizations(ctx context.Context, req *agentidentitypb.ListAuthorizationsRequest, opts ...gax.CallOption) *AuthorizationIteratorListAuthorizations lists Authorizations in a given project and location.
Examples
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
"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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.ListAuthorizationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#ListAuthorizationsRequest.
}
it := c.ListAuthorizations(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.(*agentidentitypb.ListAuthorizationsResponse)
}
}
all
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.ListAuthorizationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#ListAuthorizationsRequest.
}
for resp, err := range c.ListAuthorizations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*AuthProviderClient) ListLocations
func (c *AuthProviderClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIteratorListLocations lists information about the supported locations for this service.
This method lists locations based on the resource scope provided in the [ListLocationsRequest.name (at http://ListLocationsRequest.name)][google.cloud.location.ListLocationsRequest.name (at http://google.cloud.location.ListLocationsRequest.name)] field: * Global locations: If name is empty, the method lists the public locations available to all projects. * Project-specific locations: If name follows the format projects/{project}, the method lists locations visible to that specific project. This includes public, private, or other project-specific locations enabled for the project.
For gRPC and client library implementations, the resource name is passed as the name field. For direct service calls, the resource name is incorporated into the request path based on the specific service implementation and version.
Examples
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.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()
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.(*locationpb.ListLocationsResponse)
}
}
all
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*AuthProviderClient) QueryAuthProviders
func (c *AuthProviderClient) QueryAuthProviders(ctx context.Context, req *agentidentitypb.QueryAuthProvidersRequest, opts ...gax.CallOption) *StringIteratorQueryAuthProviders queries what all auth_providers are used by a given workload_id.
Examples
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
"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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.QueryAuthProvidersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#QueryAuthProvidersRequest.
}
it := c.QueryAuthProviders(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.(*agentidentitypb.QueryAuthProvidersResponse)
}
}
all
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.QueryAuthProvidersRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#QueryAuthProvidersRequest.
}
for resp, err := range c.QueryAuthProviders(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*AuthProviderClient) QueryWorkloads
func (c *AuthProviderClient) QueryWorkloads(ctx context.Context, req *agentidentitypb.QueryWorkloadsRequest, opts ...gax.CallOption) *StringIteratorQueryWorkloads queries what all workloads are using a given auth_provider.
Examples
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
"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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.QueryWorkloadsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#QueryWorkloadsRequest.
}
it := c.QueryWorkloads(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.(*agentidentitypb.QueryWorkloadsResponse)
}
}
all
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.QueryWorkloadsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#QueryWorkloadsRequest.
}
for resp, err := range c.QueryWorkloads(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*AuthProviderClient) RevokeAuthorization
func (c *AuthProviderClient) RevokeAuthorization(ctx context.Context, req *agentidentitypb.RevokeAuthorizationRequest, opts ...gax.CallOption) (*agentidentitypb.RevokeAuthorizationResponse, error)RevokeAuthorization revokes all authorizations for a specific user on an AuthProvider. This deletes all authorization records associated with the user and AuthProvider, effectively revoking access across all agents.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.RevokeAuthorizationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#RevokeAuthorizationRequest.
}
resp, err := c.RevokeAuthorization(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AuthProviderClient) SetIamPolicy
func (c *AuthProviderClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
iampb "cloud.google.com/go/iam/apiv1/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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.SetIamPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
}
resp, err := c.SetIamPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AuthProviderClient) TestIamPermissions
func (c *AuthProviderClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)TestIamPermissions returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may “fail open” without warning.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
iampb "cloud.google.com/go/iam/apiv1/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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.TestIamPermissionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
}
resp, err := c.TestIamPermissions(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AuthProviderClient) UndeleteAuthProvider
func (c *AuthProviderClient) UndeleteAuthProvider(ctx context.Context, req *agentidentitypb.UndeleteAuthProviderRequest, opts ...gax.CallOption) (*agentidentitypb.AuthProvider, error)UndeleteAuthProvider undeletes a single AuthProvider.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.UndeleteAuthProviderRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#UndeleteAuthProviderRequest.
}
resp, err := c.UndeleteAuthProvider(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*AuthProviderClient) UpdateAuthProvider
func (c *AuthProviderClient) UpdateAuthProvider(ctx context.Context, req *agentidentitypb.UpdateAuthProviderRequest, opts ...gax.CallOption) (*agentidentitypb.AuthProvider, error)UpdateAuthProvider updates the parameters of a single AuthProvider.
Example
package main
import (
"context"
agentidentity "cloud.google.com/go/agentidentity/apiv1"
agentidentitypb "cloud.google.com/go/agentidentity/apiv1/agentidentitypb"
)
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 := agentidentity.NewAuthProviderClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &agentidentitypb.UpdateAuthProviderRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/agentidentity/apiv1/agentidentitypb#UpdateAuthProviderRequest.
}
resp, err := c.UpdateAuthProvider(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
AuthProviderIterator
type AuthProviderIterator 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 []*agentidentitypb.AuthProvider, nextPageToken string, err error)
// contains filtered or unexported fields
}AuthProviderIterator manages a stream of *agentidentitypb.AuthProvider.
func (*AuthProviderIterator) All
func (it *AuthProviderIterator) All() iter.Seq2[*agentidentitypb.AuthProvider, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AuthProviderIterator) Next
func (it *AuthProviderIterator) Next() (*agentidentitypb.AuthProvider, 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 (*AuthProviderIterator) PageInfo
func (it *AuthProviderIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
AuthorizationIterator
type AuthorizationIterator 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 []*agentidentitypb.Authorization, nextPageToken string, err error)
// contains filtered or unexported fields
}AuthorizationIterator manages a stream of *agentidentitypb.Authorization.
func (*AuthorizationIterator) All
func (it *AuthorizationIterator) All() iter.Seq2[*agentidentitypb.Authorization, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*AuthorizationIterator) Next
func (it *AuthorizationIterator) Next() (*agentidentitypb.Authorization, 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 (*AuthorizationIterator) PageInfo
func (it *AuthorizationIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
LocationIterator
type LocationIterator 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 []*locationpb.Location, nextPageToken string, err error)
// 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, the iterator 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 more results. 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.
StringIterator
type StringIterator 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 []string, nextPageToken string, err error)
// contains filtered or unexported fields
}StringIterator manages a stream of string.
func (*StringIterator) All
func (it *StringIterator) All() iter.Seq2[string, error]All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*StringIterator) Next
func (it *StringIterator) Next() (string, 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 (*StringIterator) PageInfo
func (it *StringIterator) PageInfo() *iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.