Cloud Identity-Aware Proxy API v1 - Package cloud.google.com/go/iap/apiv1 (v1.0.1)

Package iap is an auto-generated package for the Cloud Identity-Aware Proxy API.

Controls access to cloud applications running on Google Cloud Platform.

Example usage

To get started with this package, create a client.

ctx := context.Background()
c, err := iap.NewIdentityAwareProxyAdminClient(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.

ctx := context.Background()
c, err := iap.NewIdentityAwareProxyAdminClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &iampb.SetIamPolicyRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#SetIamPolicyRequest.
}
resp, err := c.SetIamPolicy(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewClient 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.

For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

DefaultAuthScopes reports the default set of authentication scopes to use with this package.

IdentityAwareProxyAdminCallOptions

type IdentityAwareProxyAdminCallOptions struct {
	SetIamPolicy       []gax.CallOption
	GetIamPolicy       []gax.CallOption
	TestIamPermissions []gax.CallOption
	GetIapSettings     []gax.CallOption
	UpdateIapSettings  []gax.CallOption
}

IdentityAwareProxyAdminCallOptions contains the retry settings for each method of IdentityAwareProxyAdminClient.

IdentityAwareProxyAdminClient

type IdentityAwareProxyAdminClient struct {

	// 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

func NewIdentityAwareProxyAdminClient(ctx context.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

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyAdminClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*IdentityAwareProxyAdminClient) Close

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*IdentityAwareProxyAdminClient) Connection

func (c *IdentityAwareProxyAdminClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated.

func (*IdentityAwareProxyAdminClient) GetIamPolicy

GetIamPolicy gets the access control policy for an Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api (at https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api)

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"

	iampb "google.golang.org/genproto/googleapis/iam/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyAdminClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iampb.GetIamPolicyRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#GetIamPolicyRequest.
	}
	resp, err := c.GetIamPolicy(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*IdentityAwareProxyAdminClient) GetIapSettings

GetIapSettings gets the IAP settings on a particular IAP protected resource.

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"
	iappb "google.golang.org/genproto/googleapis/cloud/iap/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyAdminClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iappb.GetIapSettingsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/iap/v1#GetIapSettingsRequest.
	}
	resp, err := c.GetIapSettings(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*IdentityAwareProxyAdminClient) SetIamPolicy

SetIamPolicy sets the access control policy for an Identity-Aware Proxy protected resource. 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 (at https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api)

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"

	iampb "google.golang.org/genproto/googleapis/iam/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyAdminClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iampb.SetIamPolicyRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#SetIamPolicyRequest.
	}
	resp, err := c.SetIamPolicy(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*IdentityAwareProxyAdminClient) TestIamPermissions

TestIamPermissions returns permissions that a caller has on the Identity-Aware Proxy protected resource. More information about managing access via IAP can be found at: https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api (at https://cloud.google.com/iap/docs/managing-access#managing_access_via_the_api)

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"

	iampb "google.golang.org/genproto/googleapis/iam/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyAdminClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iampb.TestIamPermissionsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/iam/v1#TestIamPermissionsRequest.
	}
	resp, err := c.TestIamPermissions(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*IdentityAwareProxyAdminClient) UpdateIapSettings

UpdateIapSettings updates the IAP settings on a particular IAP protected resource. It replaces all fields unless the update_mask is set.

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"
	iappb "google.golang.org/genproto/googleapis/cloud/iap/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyAdminClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iappb.UpdateIapSettingsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/iap/v1#UpdateIapSettingsRequest.
	}
	resp, err := c.UpdateIapSettings(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

IdentityAwareProxyClientIterator

type IdentityAwareProxyClientIterator 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 []*iappb.IdentityAwareProxyClient, nextPageToken string, err error)
	// contains filtered or unexported fields
}

IdentityAwareProxyClientIterator manages a stream of *iappb.IdentityAwareProxyClient.

func (*IdentityAwareProxyClientIterator) Next

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 (*IdentityAwareProxyClientIterator) PageInfo

func (it *IdentityAwareProxyClientIterator) PageInfo() *iterator.PageInfo

PageInfo supports pagination. See the google.golang.org/api/iterator package for details.

IdentityAwareProxyOAuthCallOptions

type IdentityAwareProxyOAuthCallOptions struct {
	ListBrands                          []gax.CallOption
	CreateBrand                         []gax.CallOption
	GetBrand                            []gax.CallOption
	CreateIdentityAwareProxyClient      []gax.CallOption
	ListIdentityAwareProxyClients       []gax.CallOption
	GetIdentityAwareProxyClient         []gax.CallOption
	ResetIdentityAwareProxyClientSecret []gax.CallOption
	DeleteIdentityAwareProxyClient      []gax.CallOption
}

IdentityAwareProxyOAuthCallOptions contains the retry settings for each method of IdentityAwareProxyOAuthClient.

IdentityAwareProxyOAuthClient

type IdentityAwareProxyOAuthClient struct {

	// 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 OAuth clients.

func NewIdentityAwareProxyOAuthClient

func NewIdentityAwareProxyOAuthClient(ctx context.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 OAuth clients.

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyOAuthClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*IdentityAwareProxyOAuthClient) Close

Close closes the connection to the API service. The user should invoke this when the client is no longer required.

func (*IdentityAwareProxyOAuthClient) Connection

func (c *IdentityAwareProxyOAuthClient) Connection() *grpc.ClientConn

Connection returns a connection to the API service.

Deprecated.

func (*IdentityAwareProxyOAuthClient) CreateBrand

CreateBrand constructs a new OAuth brand for the project if one does not exist. The created brand is “internal only”, meaning that OAuth clients created under it only accept requests from users who belong to the same G Suite organization as the project. The brand is created in an un-reviewed status. NOTE: The “internal only” status can be manually changed in the Google Cloud console. Requires that a brand does not already exist for the project, and that the specified support email is owned by the caller.

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"

	iappb "google.golang.org/genproto/googleapis/cloud/iap/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyOAuthClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iappb.CreateBrandRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/iap/v1#CreateBrandRequest.
	}
	resp, err := c.CreateBrand(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*IdentityAwareProxyOAuthClient) CreateIdentityAwareProxyClient

CreateIdentityAwareProxyClient creates an Identity Aware Proxy (IAP) OAuth client. The client is owned by IAP. Requires that the brand for the project exists and that it is set for internal-only use.

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"

	iappb "google.golang.org/genproto/googleapis/cloud/iap/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyOAuthClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iappb.CreateIdentityAwareProxyClientRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/iap/v1#CreateIdentityAwareProxyClientRequest.
	}
	resp, err := c.CreateIdentityAwareProxyClient(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*IdentityAwareProxyOAuthClient) DeleteIdentityAwareProxyClient

func (c *IdentityAwareProxyOAuthClient) DeleteIdentityAwareProxyClient(ctx context.Context, req *iappb.DeleteIdentityAwareProxyClientRequest, opts ...gax.CallOption) error

DeleteIdentityAwareProxyClient deletes an Identity Aware Proxy (IAP) OAuth client. Useful for removing obsolete clients, managing the number of clients in a given project, and cleaning up after tests. Requires that the client is owned by IAP.

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"

	iappb "google.golang.org/genproto/googleapis/cloud/iap/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyOAuthClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iappb.DeleteIdentityAwareProxyClientRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/iap/v1#DeleteIdentityAwareProxyClientRequest.
	}
	err = c.DeleteIdentityAwareProxyClient(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*IdentityAwareProxyOAuthClient) GetBrand

GetBrand retrieves the OAuth brand of the project.

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"

	iappb "google.golang.org/genproto/googleapis/cloud/iap/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyOAuthClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iappb.GetBrandRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/iap/v1#GetBrandRequest.
	}
	resp, err := c.GetBrand(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*IdentityAwareProxyOAuthClient) GetIdentityAwareProxyClient

GetIdentityAwareProxyClient retrieves an Identity Aware Proxy (IAP) OAuth client. Requires that the client is owned by IAP.

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"

	iappb "google.golang.org/genproto/googleapis/cloud/iap/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyOAuthClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iappb.GetIdentityAwareProxyClientRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/iap/v1#GetIdentityAwareProxyClientRequest.
	}
	resp, err := c.GetIdentityAwareProxyClient(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*IdentityAwareProxyOAuthClient) ListBrands

ListBrands lists the existing brands for the project.

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"

	iappb "google.golang.org/genproto/googleapis/cloud/iap/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyOAuthClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iappb.ListBrandsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/iap/v1#ListBrandsRequest.
	}
	resp, err := c.ListBrands(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*IdentityAwareProxyOAuthClient) ListIdentityAwareProxyClients

ListIdentityAwareProxyClients lists the existing clients for the brand.

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"
	"google.golang.org/api/iterator"

	iappb "google.golang.org/genproto/googleapis/cloud/iap/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyOAuthClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iappb.ListIdentityAwareProxyClientsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/iap/v1#ListIdentityAwareProxyClientsRequest.
	}
	it := c.ListIdentityAwareProxyClients(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*IdentityAwareProxyOAuthClient) ResetIdentityAwareProxyClientSecret

ResetIdentityAwareProxyClientSecret resets an Identity Aware Proxy (IAP) OAuth client secret. Useful if the secret was compromised. Requires that the client is owned by IAP.

Example

package main

import (
	"context"

	iap "cloud.google.com/go/iap/apiv1"

	iappb "google.golang.org/genproto/googleapis/cloud/iap/v1"
)

func main() {
	ctx := context.Background()
	c, err := iap.NewIdentityAwareProxyOAuthClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &iappb.ResetIdentityAwareProxyClientSecretRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/iap/v1#ResetIdentityAwareProxyClientSecretRequest.
	}
	resp, err := c.ResetIdentityAwareProxyClientSecret(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}