Cloud Identity-Aware Proxy API v1 - Package cloud.google.com/go/iap/apiv1 (v1.11.3) Stay organized with collections Save and categorize content based on your preferences.
Package iap is an auto-generated package for theCloud Identity-Aware Proxy API.
Controls access to cloud applications running on Google Cloud Platform.
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/iap/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:=iap.NewIdentityAwareProxyAdminClient(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:=&iappb.CreateTunnelDestGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#CreateTunnelDestGroupRequest.}resp,err:=c.CreateTunnelDestGroup(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp
Use of Context
The ctx passed to NewIdentityAwareProxyAdminClient 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.
IdentityAwareProxyAdminCallOptions
typeIdentityAwareProxyAdminCallOptionsstruct{SetIamPolicy[]gax.CallOptionGetIamPolicy[]gax.CallOptionTestIamPermissions[]gax.CallOptionGetIapSettings[]gax.CallOptionUpdateIapSettings[]gax.CallOptionValidateIapAttributeExpression[]gax.CallOptionListTunnelDestGroups[]gax.CallOptionCreateTunnelDestGroup[]gax.CallOptionGetTunnelDestGroup[]gax.CallOptionDeleteTunnelDestGroup[]gax.CallOptionUpdateTunnelDestGroup[]gax.CallOption}IdentityAwareProxyAdminCallOptions contains the retry settings for each method of IdentityAwareProxyAdminClient.
IdentityAwareProxyAdminClient
typeIdentityAwareProxyAdminClientstruct{// The call options for this service.CallOptions*IdentityAwareProxyAdminCallOptions// contains filtered or unexported fields}IdentityAwareProxyAdminClient is a client for interacting with Cloud Identity-Aware Proxy API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
APIs for Identity-Aware Proxy Admin configurations.
func NewIdentityAwareProxyAdminClient
funcNewIdentityAwareProxyAdminClient(ctxcontext.Context,opts...option.ClientOption)(*IdentityAwareProxyAdminClient,error)NewIdentityAwareProxyAdminClient creates a new identity aware proxy admin service client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
APIs for Identity-Aware Proxy Admin configurations.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewIdentityAwareProxyAdminRESTClient
funcNewIdentityAwareProxyAdminRESTClient(ctxcontext.Context,opts...option.ClientOption)(*IdentityAwareProxyAdminClient,error)NewIdentityAwareProxyAdminRESTClient creates a new identity aware proxy admin service rest client.
APIs for Identity-Aware Proxy Admin configurations.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/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:=iap.NewIdentityAwareProxyAdminRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*IdentityAwareProxyAdminClient) Close
func(c*IdentityAwareProxyAdminClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*IdentityAwareProxyAdminClient) Connection (deprecated)
func(c*IdentityAwareProxyAdminClient)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 (*IdentityAwareProxyAdminClient) CreateTunnelDestGroup
func(c*IdentityAwareProxyAdminClient)CreateTunnelDestGroup(ctxcontext.Context,req*iappb.CreateTunnelDestGroupRequest,opts...gax.CallOption)(*iappb.TunnelDestGroup,error)CreateTunnelDestGroup creates a new TunnelDestGroup.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.CreateTunnelDestGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#CreateTunnelDestGroupRequest.}resp,err:=c.CreateTunnelDestGroup(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyAdminClient) DeleteTunnelDestGroup
func(c*IdentityAwareProxyAdminClient)DeleteTunnelDestGroup(ctxcontext.Context,req*iappb.DeleteTunnelDestGroupRequest,opts...gax.CallOption)errorDeleteTunnelDestGroup deletes a TunnelDestGroup.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.DeleteTunnelDestGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#DeleteTunnelDestGroupRequest.}err=c.DeleteTunnelDestGroup(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*IdentityAwareProxyAdminClient) GetIamPolicy
func(c*IdentityAwareProxyAdminClient)GetIamPolicy(ctxcontext.Context,req*iampb.GetIamPolicyRequest,opts...gax.CallOption)(*iampb.Policy,error)GetIamPolicy gets the access control policy for an Identity-Aware Proxy protectedresource.More information about managing access via IAP can be found at:https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api (athttps://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api)
Example
packagemainimport("context"iampb"cloud.google.com/go/iam/apiv1/iampb"iap"cloud.google.com/go/iap/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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.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)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyAdminClient) GetIapSettings
func(c*IdentityAwareProxyAdminClient)GetIapSettings(ctxcontext.Context,req*iappb.GetIapSettingsRequest,opts...gax.CallOption)(*iappb.IapSettings,error)GetIapSettings gets the IAP settings on a particular IAP protected resource.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.GetIapSettingsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#GetIapSettingsRequest.}resp,err:=c.GetIapSettings(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyAdminClient) GetTunnelDestGroup
func(c*IdentityAwareProxyAdminClient)GetTunnelDestGroup(ctxcontext.Context,req*iappb.GetTunnelDestGroupRequest,opts...gax.CallOption)(*iappb.TunnelDestGroup,error)GetTunnelDestGroup retrieves an existing TunnelDestGroup.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.GetTunnelDestGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#GetTunnelDestGroupRequest.}resp,err:=c.GetTunnelDestGroup(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyAdminClient) ListTunnelDestGroups
func(c*IdentityAwareProxyAdminClient)ListTunnelDestGroups(ctxcontext.Context,req*iappb.ListTunnelDestGroupsRequest,opts...gax.CallOption)*TunnelDestGroupIteratorListTunnelDestGroups lists the existing TunnelDestGroups. To group across all locations, use a
- as the location ID. For example:/v1/projects/123/iap_tunnel/locations/-/destGroups
Examples
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb""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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.ListTunnelDestGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#ListTunnelDestGroupsRequest.}it:=c.ListTunnelDestGroups(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.(*iappb.ListTunnelDestGroupsResponse)}}all
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.ListTunnelDestGroupsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#ListTunnelDestGroupsRequest.}forresp,err:=rangec.ListTunnelDestGroups(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*IdentityAwareProxyAdminClient) SetIamPolicy
func(c*IdentityAwareProxyAdminClient)SetIamPolicy(ctxcontext.Context,req*iampb.SetIamPolicyRequest,opts...gax.CallOption)(*iampb.Policy,error)SetIamPolicy sets the access control policy for an Identity-Aware Proxy protectedresource. Replaces any existing policy.More information about managing access via IAP can be found at:https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api (athttps://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api)
Example
packagemainimport("context"iampb"cloud.google.com/go/iam/apiv1/iampb"iap"cloud.google.com/go/iap/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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.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)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyAdminClient) TestIamPermissions
func(c*IdentityAwareProxyAdminClient)TestIamPermissions(ctxcontext.Context,req*iampb.TestIamPermissionsRequest,opts...gax.CallOption)(*iampb.TestIamPermissionsResponse,error)TestIamPermissions returns permissions that a caller has on the Identity-Aware Proxy protectedresource.More information about managing access via IAP can be found at:https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api (athttps://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api)
Example
packagemainimport("context"iampb"cloud.google.com/go/iam/apiv1/iampb"iap"cloud.google.com/go/iap/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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.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)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyAdminClient) UpdateIapSettings
func(c*IdentityAwareProxyAdminClient)UpdateIapSettings(ctxcontext.Context,req*iappb.UpdateIapSettingsRequest,opts...gax.CallOption)(*iappb.IapSettings,error)UpdateIapSettings updates the IAP settings on a particular IAP protected resource. Itreplaces all fields unless the update_mask is set.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.UpdateIapSettingsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#UpdateIapSettingsRequest.}resp,err:=c.UpdateIapSettings(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyAdminClient) UpdateTunnelDestGroup
func(c*IdentityAwareProxyAdminClient)UpdateTunnelDestGroup(ctxcontext.Context,req*iappb.UpdateTunnelDestGroupRequest,opts...gax.CallOption)(*iappb.TunnelDestGroup,error)UpdateTunnelDestGroup updates a TunnelDestGroup.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.UpdateTunnelDestGroupRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#UpdateTunnelDestGroupRequest.}resp,err:=c.UpdateTunnelDestGroup(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyAdminClient) ValidateIapAttributeExpression
func(c*IdentityAwareProxyAdminClient)ValidateIapAttributeExpression(ctxcontext.Context,req*iappb.ValidateIapAttributeExpressionRequest,opts...gax.CallOption)(*iappb.ValidateIapAttributeExpressionResponse,error)ValidateIapAttributeExpression validates that a given CEL expression conforms to IAP restrictions.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyAdminClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.ValidateIapAttributeExpressionRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#ValidateIapAttributeExpressionRequest.}resp,err:=c.ValidateIapAttributeExpression(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}IdentityAwareProxyClientIterator
typeIdentityAwareProxyClientIteratorstruct{// 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[]*iappb.IdentityAwareProxyClient,nextPageTokenstring,errerror)// contains filtered or unexported fields}IdentityAwareProxyClientIterator manages a stream of *iappb.IdentityAwareProxyClient.
func (*IdentityAwareProxyClientIterator) All
func(it*IdentityAwareProxyClientIterator)All()iter.Seq2[*iappb.IdentityAwareProxyClient,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*IdentityAwareProxyClientIterator) Next
func(it*IdentityAwareProxyClientIterator)Next()(*iappb.IdentityAwareProxyClient,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 (*IdentityAwareProxyClientIterator) PageInfo
func(it*IdentityAwareProxyClientIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
IdentityAwareProxyOAuthCallOptions
typeIdentityAwareProxyOAuthCallOptionsstruct{ListBrands[]gax.CallOptionCreateBrand[]gax.CallOptionGetBrand[]gax.CallOptionCreateIdentityAwareProxyClient[]gax.CallOptionListIdentityAwareProxyClients[]gax.CallOptionGetIdentityAwareProxyClient[]gax.CallOptionResetIdentityAwareProxyClientSecret[]gax.CallOptionDeleteIdentityAwareProxyClient[]gax.CallOption}IdentityAwareProxyOAuthCallOptions contains the retry settings for each method of IdentityAwareProxyOAuthClient.
IdentityAwareProxyOAuthClient
typeIdentityAwareProxyOAuthClientstruct{// The call options for this service.CallOptions*IdentityAwareProxyOAuthCallOptions// contains filtered or unexported fields}IdentityAwareProxyOAuthClient is a client for interacting with Cloud Identity-Aware Proxy API.Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
API to programmatically create, list and retrieve Identity Aware Proxy (IAP)OAuth brands; and create, retrieve, delete and reset-secret of IAP OAuthclients.
func NewIdentityAwareProxyOAuthClient
funcNewIdentityAwareProxyOAuthClient(ctxcontext.Context,opts...option.ClientOption)(*IdentityAwareProxyOAuthClient,error)NewIdentityAwareProxyOAuthClient creates a new identity aware proxyo auth service client based on gRPC.The returned client must be Closed when it is done being used to clean up its underlying connections.
API to programmatically create, list and retrieve Identity Aware Proxy (IAP)OAuth brands; and create, retrieve, delete and reset-secret of IAP OAuthclients.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/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:=iap.NewIdentityAwareProxyOAuthClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func NewIdentityAwareProxyOAuthRESTClient
funcNewIdentityAwareProxyOAuthRESTClient(ctxcontext.Context,opts...option.ClientOption)(*IdentityAwareProxyOAuthClient,error)NewIdentityAwareProxyOAuthRESTClient creates a new identity aware proxyo auth service rest client.
API to programmatically create, list and retrieve Identity Aware Proxy (IAP)OAuth brands; and create, retrieve, delete and reset-secret of IAP OAuthclients.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/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:=iap.NewIdentityAwareProxyOAuthRESTClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()// TODO: Use client._=c}func (*IdentityAwareProxyOAuthClient) Close
func(c*IdentityAwareProxyOAuthClient)Close()errorClose closes the connection to the API service. The user should invoke this whenthe client is no longer required.
func (*IdentityAwareProxyOAuthClient) Connection (deprecated)
func(c*IdentityAwareProxyOAuthClient)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 (*IdentityAwareProxyOAuthClient) CreateBrand
func(c*IdentityAwareProxyOAuthClient)CreateBrand(ctxcontext.Context,req*iappb.CreateBrandRequest,opts...gax.CallOption)(*iappb.Brand,error)CreateBrand constructs a new OAuth brand for the project if one does not exist.The created brand is “internal only”, meaning that OAuth clients createdunder it only accept requests from users who belong to the same GoogleWorkspace organization as the project. The brand is created in anun-reviewed status. NOTE: The “internal only” status can be manuallychanged in the Google Cloud Console. Requires that a brand does not alreadyexist for the project, and that the specified support email is owned by thecaller.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyOAuthClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.CreateBrandRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#CreateBrandRequest.}resp,err:=c.CreateBrand(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyOAuthClient) CreateIdentityAwareProxyClient
func(c*IdentityAwareProxyOAuthClient)CreateIdentityAwareProxyClient(ctxcontext.Context,req*iappb.CreateIdentityAwareProxyClientRequest,opts...gax.CallOption)(*iappb.IdentityAwareProxyClient,error)CreateIdentityAwareProxyClient creates an Identity Aware Proxy (IAP) OAuth client. The client is ownedby IAP. Requires that the brand for the project exists and that it isset for internal-only use.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyOAuthClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.CreateIdentityAwareProxyClientRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#CreateIdentityAwareProxyClientRequest.}resp,err:=c.CreateIdentityAwareProxyClient(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyOAuthClient) DeleteIdentityAwareProxyClient
func(c*IdentityAwareProxyOAuthClient)DeleteIdentityAwareProxyClient(ctxcontext.Context,req*iappb.DeleteIdentityAwareProxyClientRequest,opts...gax.CallOption)errorDeleteIdentityAwareProxyClient deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removingobsolete clients, managing the number of clients in a given project, andcleaning up after tests. Requires that the client is owned by IAP.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyOAuthClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.DeleteIdentityAwareProxyClientRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#DeleteIdentityAwareProxyClientRequest.}err=c.DeleteIdentityAwareProxyClient(ctx,req)iferr!=nil{// TODO: Handle error.}}func (*IdentityAwareProxyOAuthClient) GetBrand
func(c*IdentityAwareProxyOAuthClient)GetBrand(ctxcontext.Context,req*iappb.GetBrandRequest,opts...gax.CallOption)(*iappb.Brand,error)GetBrand retrieves the OAuth brand of the project.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyOAuthClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.GetBrandRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#GetBrandRequest.}resp,err:=c.GetBrand(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyOAuthClient) GetIdentityAwareProxyClient
func(c*IdentityAwareProxyOAuthClient)GetIdentityAwareProxyClient(ctxcontext.Context,req*iappb.GetIdentityAwareProxyClientRequest,opts...gax.CallOption)(*iappb.IdentityAwareProxyClient,error)GetIdentityAwareProxyClient retrieves an Identity Aware Proxy (IAP) OAuth client.Requires that the client is owned by IAP.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyOAuthClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.GetIdentityAwareProxyClientRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#GetIdentityAwareProxyClientRequest.}resp,err:=c.GetIdentityAwareProxyClient(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyOAuthClient) ListBrands
func(c*IdentityAwareProxyOAuthClient)ListBrands(ctxcontext.Context,req*iappb.ListBrandsRequest,opts...gax.CallOption)(*iappb.ListBrandsResponse,error)ListBrands lists the existing brands for the project.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyOAuthClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.ListBrandsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#ListBrandsRequest.}resp,err:=c.ListBrands(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}func (*IdentityAwareProxyOAuthClient) ListIdentityAwareProxyClients
func(c*IdentityAwareProxyOAuthClient)ListIdentityAwareProxyClients(ctxcontext.Context,req*iappb.ListIdentityAwareProxyClientsRequest,opts...gax.CallOption)*IdentityAwareProxyClientIteratorListIdentityAwareProxyClients lists the existing clients for the brand.
Examples
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb""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:=iap.NewIdentityAwareProxyOAuthClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.ListIdentityAwareProxyClientsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#ListIdentityAwareProxyClientsRequest.}it:=c.ListIdentityAwareProxyClients(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.(*iappb.ListIdentityAwareProxyClientsResponse)}}all
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyOAuthClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.ListIdentityAwareProxyClientsRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#ListIdentityAwareProxyClientsRequest.}forresp,err:=rangec.ListIdentityAwareProxyClients(ctx,req).All(){iferr!=nil{// TODO: Handle error and break/return/continue. Iteration will stop after any error.}// TODO: Use resp._=resp}}func (*IdentityAwareProxyOAuthClient) ResetIdentityAwareProxyClientSecret
func(c*IdentityAwareProxyOAuthClient)ResetIdentityAwareProxyClientSecret(ctxcontext.Context,req*iappb.ResetIdentityAwareProxyClientSecretRequest,opts...gax.CallOption)(*iappb.IdentityAwareProxyClient,error)ResetIdentityAwareProxyClientSecret resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if thesecret was compromised. Requires that the client is owned by IAP.
Example
packagemainimport("context"iap"cloud.google.com/go/iap/apiv1"iappb"cloud.google.com/go/iap/apiv1/iappb")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:=iap.NewIdentityAwareProxyOAuthClient(ctx)iferr!=nil{// TODO: Handle error.}deferc.Close()req:=&iappb.ResetIdentityAwareProxyClientSecretRequest{// TODO: Fill request struct fields.// See https://pkg.go.dev/cloud.google.com/go/iap/apiv1/iappb#ResetIdentityAwareProxyClientSecretRequest.}resp,err:=c.ResetIdentityAwareProxyClientSecret(ctx,req)iferr!=nil{// TODO: Handle error.}// TODO: Use resp._=resp}TunnelDestGroupIterator
typeTunnelDestGroupIteratorstruct{// 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[]*iappb.TunnelDestGroup,nextPageTokenstring,errerror)// contains filtered or unexported fields}TunnelDestGroupIterator manages a stream of *iappb.TunnelDestGroup.
func (*TunnelDestGroupIterator) All
func(it*TunnelDestGroupIterator)All()iter.Seq2[*iappb.TunnelDestGroup,error]All returns an iterator. If an error is returned by the iterator, theiterator will stop after that iteration.
func (*TunnelDestGroupIterator) Next
func(it*TunnelDestGroupIterator)Next()(*iappb.TunnelDestGroup,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 (*TunnelDestGroupIterator) PageInfo
func(it*TunnelDestGroupIterator)PageInfo()*iterator.PageInfoPageInfo supports pagination. See the [google.golang.org/api/iterator] package for details.
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.