Cloud Resource Manager API v3 - Package cloud.google.com/go/resourcemanager/apiv3 (v1.3.0)

Stay organized with collections Save and categorize content based on your preferences.

Package resourcemanager is an auto-generated package for the Cloud Resource Manager API.

Creates, reads, and updates metadata for Google Cloud Platform resource containers.

NOTE: This package is in beta. It is not stable, and may be subject to changes.

Example usage

To get started with this package, create a client.

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 := resourcemanager.NewFoldersClient(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()
// 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 := resourcemanager.NewFoldersClient(ctx)
if err != nil {
    // TODO: Handle error.
}
defer c.Close()

req := &resourcemanagerpb.GetFolderRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#GetFolderRequest.
}
resp, err := c.GetFolder(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

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

CreateFolderOperation

type CreateFolderOperation struct {
	// contains filtered or unexported fields
}

CreateFolderOperation manages a long-running operation from CreateFolder.

func (*CreateFolderOperation) Done

func (op *CreateFolderOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*CreateFolderOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*CreateFolderOperation) Name

func (op *CreateFolderOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*CreateFolderOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*CreateFolderOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

CreateProjectOperation

type CreateProjectOperation struct {
	// contains filtered or unexported fields
}

CreateProjectOperation manages a long-running operation from CreateProject.

func (*CreateProjectOperation) Done

func (op *CreateProjectOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*CreateProjectOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*CreateProjectOperation) Name

func (op *CreateProjectOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*CreateProjectOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*CreateProjectOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

CreateTagBindingOperation

type CreateTagBindingOperation struct {
	// contains filtered or unexported fields
}

CreateTagBindingOperation manages a long-running operation from CreateTagBinding.

func (*CreateTagBindingOperation) Done

func (op *CreateTagBindingOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*CreateTagBindingOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*CreateTagBindingOperation) Name

func (op *CreateTagBindingOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*CreateTagBindingOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*CreateTagBindingOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

CreateTagKeyOperation

type CreateTagKeyOperation struct {
	// contains filtered or unexported fields
}

CreateTagKeyOperation manages a long-running operation from CreateTagKey.

func (*CreateTagKeyOperation) Done

func (op *CreateTagKeyOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*CreateTagKeyOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*CreateTagKeyOperation) Name

func (op *CreateTagKeyOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*CreateTagKeyOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*CreateTagKeyOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

CreateTagValueOperation

type CreateTagValueOperation struct {
	// contains filtered or unexported fields
}

CreateTagValueOperation manages a long-running operation from CreateTagValue.

func (*CreateTagValueOperation) Done

func (op *CreateTagValueOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*CreateTagValueOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*CreateTagValueOperation) Name

func (op *CreateTagValueOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*CreateTagValueOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*CreateTagValueOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

DeleteFolderOperation

type DeleteFolderOperation struct {
	// contains filtered or unexported fields
}

DeleteFolderOperation manages a long-running operation from DeleteFolder.

func (*DeleteFolderOperation) Done

func (op *DeleteFolderOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*DeleteFolderOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*DeleteFolderOperation) Name

func (op *DeleteFolderOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*DeleteFolderOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*DeleteFolderOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

DeleteProjectOperation

type DeleteProjectOperation struct {
	// contains filtered or unexported fields
}

DeleteProjectOperation manages a long-running operation from DeleteProject.

func (*DeleteProjectOperation) Done

func (op *DeleteProjectOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*DeleteProjectOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*DeleteProjectOperation) Name

func (op *DeleteProjectOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*DeleteProjectOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*DeleteProjectOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

DeleteTagBindingOperation

type DeleteTagBindingOperation struct {
	// contains filtered or unexported fields
}

DeleteTagBindingOperation manages a long-running operation from DeleteTagBinding.

func (*DeleteTagBindingOperation) Done

func (op *DeleteTagBindingOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*DeleteTagBindingOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*DeleteTagBindingOperation) Name

func (op *DeleteTagBindingOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*DeleteTagBindingOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*DeleteTagBindingOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

DeleteTagKeyOperation

type DeleteTagKeyOperation struct {
	// contains filtered or unexported fields
}

DeleteTagKeyOperation manages a long-running operation from DeleteTagKey.

func (*DeleteTagKeyOperation) Done

func (op *DeleteTagKeyOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*DeleteTagKeyOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*DeleteTagKeyOperation) Name

func (op *DeleteTagKeyOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*DeleteTagKeyOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*DeleteTagKeyOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

DeleteTagValueOperation

type DeleteTagValueOperation struct {
	// contains filtered or unexported fields
}

DeleteTagValueOperation manages a long-running operation from DeleteTagValue.

func (*DeleteTagValueOperation) Done

func (op *DeleteTagValueOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*DeleteTagValueOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*DeleteTagValueOperation) Name

func (op *DeleteTagValueOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*DeleteTagValueOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*DeleteTagValueOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

FolderIterator

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

FolderIterator manages a stream of *resourcemanagerpb.Folder.

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

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

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

FoldersCallOptions

type FoldersCallOptions struct {
	GetFolder          []gax.CallOption
	ListFolders        []gax.CallOption
	SearchFolders      []gax.CallOption
	CreateFolder       []gax.CallOption
	UpdateFolder       []gax.CallOption
	MoveFolder         []gax.CallOption
	DeleteFolder       []gax.CallOption
	UndeleteFolder     []gax.CallOption
	GetIamPolicy       []gax.CallOption
	SetIamPolicy       []gax.CallOption
	TestIamPermissions []gax.CallOption
}

FoldersCallOptions contains the retry settings for each method of FoldersClient.

FoldersClient

type FoldersClient struct {

	// The call options for this service.
	CallOptions *FoldersCallOptions

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

FoldersClient is a client for interacting with Cloud Resource Manager API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Manages Cloud Platform folder resources. Folders can be used to organize the resources under an organization and to control the policies applied to groups of resources.

func NewFoldersClient

func NewFoldersClient(ctx context.Context, opts ...option.ClientOption) (*FoldersClient, error)

NewFoldersClient creates a new folders client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Manages Cloud Platform folder resources. Folders can be used to organize the resources under an organization and to control the policies applied to groups of resources.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
)

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 := resourcemanager.NewFoldersClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*FoldersClient) Close

func (c *FoldersClient) Close() error

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

func (*FoldersClient) Connection (deprecated)

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

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*FoldersClient) CreateFolder

CreateFolder creates a folder in the resource hierarchy. Returns an Operation which can be used to track the progress of the folder creation workflow. Upon success, the Operation.response field will be populated with the created Folder.

In order to succeed, the addition of this new folder must not violate the folder naming, height, or fanout constraints.

The folder’s display_name must be distinct from all other folders that
share its parent.

The addition of the folder must not cause the active folder hierarchy
to exceed a height of 10. Note, the full active + deleted folder hierarchy
is allowed to reach a height of 20; this provides additional headroom when
moving folders that contain deleted folders.

The addition of the folder must not cause the total number of folders
under its parent to exceed 300.

If the operation fails due to a folder constraint violation, some errors may be returned by the CreateFolder request, with status code FAILED_PRECONDITION and an error description. Other folder constraint violations will be communicated in the Operation, with the specific PreconditionFailure returned in the details list in the Operation.error field.

The caller must have resourcemanager.folders.create permission on the identified parent.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewFoldersClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.CreateFolderRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#CreateFolderRequest.
	}
	op, err := c.CreateFolder(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*FoldersClient) CreateFolderOperation

func (c *FoldersClient) CreateFolderOperation(name string) *CreateFolderOperation

CreateFolderOperation returns a new CreateFolderOperation from a given name. The name must be that of a previously created CreateFolderOperation, possibly from a different process.

func (*FoldersClient) DeleteFolder

DeleteFolder requests deletion of a folder. The folder is moved into the DELETE_REQUESTED state immediately, and is deleted approximately 30 days later. This method may only be called on an empty folder, where a folder is empty if it doesn’t contain any folders or projects in the [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE (at http://google.cloud.resourcemanager.v3.Folder.State.ACTIVE)] state. If called on a folder in DELETE_REQUESTED state the operation will result in a no-op success. The caller must have resourcemanager.folders.delete permission on the identified folder.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewFoldersClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.DeleteFolderRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#DeleteFolderRequest.
	}
	op, err := c.DeleteFolder(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*FoldersClient) DeleteFolderOperation

func (c *FoldersClient) DeleteFolderOperation(name string) *DeleteFolderOperation

DeleteFolderOperation returns a new DeleteFolderOperation from a given name. The name must be that of a previously created DeleteFolderOperation, possibly from a different process.

func (*FoldersClient) GetFolder

GetFolder retrieves a folder identified by the supplied resource name. Valid folder resource names have the format folders/{folder_id} (for example, folders/1234). The caller must have resourcemanager.folders.get permission on the identified folder.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewFoldersClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.GetFolderRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#GetFolderRequest.
	}
	resp, err := c.GetFolder(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*FoldersClient) GetIamPolicy

func (c *FoldersClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

GetIamPolicy gets the access control policy for a folder. The returned policy may be empty if no such policy or resource exists. The resource field should be the folder’s resource name, for example: “folders/1234”. The caller must have resourcemanager.folders.getIamPolicy permission on the identified folder.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewFoldersClient(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 (*FoldersClient) ListFolders

ListFolders lists the folders that are direct descendants of supplied parent resource. list() provides a strongly consistent view of the folders underneath the specified parent resource. list() returns folders sorted based upon the (ascending) lexical ordering of their display_name. The caller must have resourcemanager.folders.list permission on the identified parent.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
	"google.golang.org/api/iterator"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewFoldersClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

func (*FoldersClient) MoveFolder

MoveFolder moves a folder under a new resource parent. Returns an Operation which can be used to track the progress of the folder move workflow. Upon success, the Operation.response field will be populated with the moved folder. Upon failure, a FolderOperationError categorizing the failure cause will be returned - if the failure occurs synchronously then the FolderOperationError will be returned in the Status.details field. If it occurs asynchronously, then the FolderOperation will be returned in the Operation.error field. In addition, the Operation.metadata field will be populated with a FolderOperation message as an aid to stateless clients. Folder moves will be rejected if they violate either the naming, height, or fanout constraints described in the CreateFolder documentation. The caller must have resourcemanager.folders.move permission on the folder’s current and proposed new parent.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewFoldersClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.MoveFolderRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#MoveFolderRequest.
	}
	op, err := c.MoveFolder(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*FoldersClient) MoveFolderOperation

func (c *FoldersClient) MoveFolderOperation(name string) *MoveFolderOperation

MoveFolderOperation returns a new MoveFolderOperation from a given name. The name must be that of a previously created MoveFolderOperation, possibly from a different process.

func (*FoldersClient) SearchFolders

SearchFolders search for folders that match specific filter criteria. search() provides an eventually consistent view of the folders a user has access to which meet the specified filter criteria.

This will only return folders on which the caller has the permission resourcemanager.folders.get.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
	"google.golang.org/api/iterator"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewFoldersClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

func (*FoldersClient) SetIamPolicy

func (c *FoldersClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

SetIamPolicy sets the access control policy on a folder, replacing any existing policy. The resource field should be the folder’s resource name, for example: “folders/1234”. The caller must have resourcemanager.folders.setIamPolicy permission on the identified folder.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewFoldersClient(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 (*FoldersClient) TestIamPermissions

TestIamPermissions returns permissions that a caller has on the specified folder. The resource field should be the folder’s resource name, for example: “folders/1234”.

There are no permissions required for making this API call.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewFoldersClient(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 (*FoldersClient) UndeleteFolder

UndeleteFolder cancels the deletion request for a folder. This method may be called on a folder in any state. If the folder is in the [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE (at http://google.cloud.resourcemanager.v3.Folder.State.ACTIVE)] state the result will be a no-op success. In order to succeed, the folder’s parent must be in the [ACTIVE][google.cloud.resourcemanager.v3.Folder.State.ACTIVE (at http://google.cloud.resourcemanager.v3.Folder.State.ACTIVE)] state. In addition, reintroducing the folder into the tree must not violate folder naming, height, and fanout constraints described in the CreateFolder documentation. The caller must have resourcemanager.folders.undelete permission on the identified folder.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewFoldersClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.UndeleteFolderRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#UndeleteFolderRequest.
	}
	op, err := c.UndeleteFolder(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*FoldersClient) UndeleteFolderOperation

func (c *FoldersClient) UndeleteFolderOperation(name string) *UndeleteFolderOperation

UndeleteFolderOperation returns a new UndeleteFolderOperation from a given name. The name must be that of a previously created UndeleteFolderOperation, possibly from a different process.

func (*FoldersClient) UpdateFolder

UpdateFolder updates a folder, changing its display_name. Changes to the folder display_name will be rejected if they violate either the display_name formatting rules or the naming constraints described in the CreateFolder documentation.

The folder’s display_name must start and end with a letter or digit, may contain letters, digits, spaces, hyphens and underscores and can be between 3 and 30 characters. This is captured by the regular expression: [\p{L}\p{N}][\p{L}\p{N}_- ]{1,28}[\p{L}\p{N}]. The caller must have resourcemanager.folders.update permission on the identified folder.

If the update fails due to the unique name constraint then a PreconditionFailure explaining this violation will be returned in the Status.details field.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewFoldersClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.UpdateFolderRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#UpdateFolderRequest.
	}
	op, err := c.UpdateFolder(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*FoldersClient) UpdateFolderOperation

func (c *FoldersClient) UpdateFolderOperation(name string) *UpdateFolderOperation

UpdateFolderOperation returns a new UpdateFolderOperation from a given name. The name must be that of a previously created UpdateFolderOperation, possibly from a different process.

MoveFolderOperation

type MoveFolderOperation struct {
	// contains filtered or unexported fields
}

MoveFolderOperation manages a long-running operation from MoveFolder.

func (*MoveFolderOperation) Done

func (op *MoveFolderOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*MoveFolderOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*MoveFolderOperation) Name

func (op *MoveFolderOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*MoveFolderOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*MoveFolderOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

MoveProjectOperation

type MoveProjectOperation struct {
	// contains filtered or unexported fields
}

MoveProjectOperation manages a long-running operation from MoveProject.

func (*MoveProjectOperation) Done

func (op *MoveProjectOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*MoveProjectOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*MoveProjectOperation) Name

func (op *MoveProjectOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*MoveProjectOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*MoveProjectOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

OrganizationIterator

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

OrganizationIterator manages a stream of *resourcemanagerpb.Organization.

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

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

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

OrganizationsCallOptions

type OrganizationsCallOptions struct {
	GetOrganization     []gax.CallOption
	SearchOrganizations []gax.CallOption
	GetIamPolicy        []gax.CallOption
	SetIamPolicy        []gax.CallOption
	TestIamPermissions  []gax.CallOption
}

OrganizationsCallOptions contains the retry settings for each method of OrganizationsClient.

OrganizationsClient

type OrganizationsClient struct {

	// The call options for this service.
	CallOptions *OrganizationsCallOptions
	// contains filtered or unexported fields
}

OrganizationsClient is a client for interacting with Cloud Resource Manager API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Allows users to manage their organization resources.

func NewOrganizationsClient

func NewOrganizationsClient(ctx context.Context, opts ...option.ClientOption) (*OrganizationsClient, error)

NewOrganizationsClient creates a new organizations client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Allows users to manage their organization resources.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
)

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 := resourcemanager.NewOrganizationsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*OrganizationsClient) Close

func (c *OrganizationsClient) Close() error

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

func (*OrganizationsClient) Connection (deprecated)

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

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*OrganizationsClient) GetIamPolicy

func (c *OrganizationsClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

GetIamPolicy gets the access control policy for an organization resource. The policy may be empty if no such policy or resource exists. The resource field should be the organization’s resource name, for example: “organizations/123”.

Authorization requires the IAM permission resourcemanager.organizations.getIamPolicy on the specified organization.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewOrganizationsClient(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 (*OrganizationsClient) GetOrganization

GetOrganization fetches an organization resource identified by the specified resource name.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewOrganizationsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.GetOrganizationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#GetOrganizationRequest.
	}
	resp, err := c.GetOrganization(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*OrganizationsClient) SearchOrganizations

SearchOrganizations searches organization resources that are visible to the user and satisfy the specified filter. This method returns organizations in an unspecified order. New organizations do not necessarily appear at the end of the results, and may take a small amount of time to appear.

Search will only return organizations on which the user has the permission resourcemanager.organizations.get

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
	"google.golang.org/api/iterator"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewOrganizationsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

func (*OrganizationsClient) SetIamPolicy

func (c *OrganizationsClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

SetIamPolicy sets the access control policy on an organization resource. Replaces any existing policy. The resource field should be the organization’s resource name, for example: “organizations/123”.

Authorization requires the IAM permission resourcemanager.organizations.setIamPolicy on the specified organization.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewOrganizationsClient(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 (*OrganizationsClient) TestIamPermissions

TestIamPermissions returns the permissions that a caller has on the specified organization. The resource field should be the organization’s resource name, for example: “organizations/123”.

There are no permissions required for making this API call.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewOrganizationsClient(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
}

ProjectIterator

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

ProjectIterator manages a stream of *resourcemanagerpb.Project.

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

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

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

ProjectsCallOptions

type ProjectsCallOptions struct {
	GetProject         []gax.CallOption
	ListProjects       []gax.CallOption
	SearchProjects     []gax.CallOption
	CreateProject      []gax.CallOption
	UpdateProject      []gax.CallOption
	MoveProject        []gax.CallOption
	DeleteProject      []gax.CallOption
	UndeleteProject    []gax.CallOption
	GetIamPolicy       []gax.CallOption
	SetIamPolicy       []gax.CallOption
	TestIamPermissions []gax.CallOption
}

ProjectsCallOptions contains the retry settings for each method of ProjectsClient.

ProjectsClient

type ProjectsClient struct {

	// The call options for this service.
	CallOptions *ProjectsCallOptions

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

ProjectsClient is a client for interacting with Cloud Resource Manager API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Manages Google Cloud Projects.

func NewProjectsClient

func NewProjectsClient(ctx context.Context, opts ...option.ClientOption) (*ProjectsClient, error)

NewProjectsClient creates a new projects client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Manages Google Cloud Projects.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
)

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 := resourcemanager.NewProjectsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*ProjectsClient) Close

func (c *ProjectsClient) Close() error

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

func (*ProjectsClient) Connection (deprecated)

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

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*ProjectsClient) CreateProject

CreateProject request that a new project be created. The result is an Operation which can be used to track the creation process. This process usually takes a few seconds, but can sometimes take much longer. The tracking Operation is automatically deleted after a few hours, so there is no need to call DeleteOperation.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewProjectsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.CreateProjectRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#CreateProjectRequest.
	}
	op, err := c.CreateProject(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ProjectsClient) CreateProjectOperation

func (c *ProjectsClient) CreateProjectOperation(name string) *CreateProjectOperation

CreateProjectOperation returns a new CreateProjectOperation from a given name. The name must be that of a previously created CreateProjectOperation, possibly from a different process.

func (*ProjectsClient) DeleteProject

DeleteProject marks the project identified by the specified name (for example, projects/415104041262) for deletion.

This method will only affect the project if it has a lifecycle state of [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE (at http://google.cloud.resourcemanager.v3.Project.State.ACTIVE)].

This method changes the Project’s lifecycle state from [ACTIVE][google.cloud.resourcemanager.v3.Project.State.ACTIVE (at http://google.cloud.resourcemanager.v3.Project.State.ACTIVE)] to DELETE_REQUESTED. The deletion starts at an unspecified time, at which point the Project is no longer accessible.

Until the deletion completes, you can check the lifecycle state checked by retrieving the project with [GetProject] [google.cloud.resourcemanager.v3.Projects.GetProject], and the project remains visible to [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects]. However, you cannot update the project.

After the deletion completes, the project is not retrievable by the [GetProject] [google.cloud.resourcemanager.v3.Projects.GetProject], [ListProjects] [google.cloud.resourcemanager.v3.Projects.ListProjects], and SearchProjects methods.

This method behaves idempotently, such that deleting a DELETE_REQUESTED project will not cause an error, but also won’t do anything.

The caller must have resourcemanager.projects.delete permissions for this project.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewProjectsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.DeleteProjectRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#DeleteProjectRequest.
	}
	op, err := c.DeleteProject(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ProjectsClient) DeleteProjectOperation

func (c *ProjectsClient) DeleteProjectOperation(name string) *DeleteProjectOperation

DeleteProjectOperation returns a new DeleteProjectOperation from a given name. The name must be that of a previously created DeleteProjectOperation, possibly from a different process.

func (*ProjectsClient) GetIamPolicy

func (c *ProjectsClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

GetIamPolicy returns the IAM access control policy for the specified project. Permission is denied if the policy or the resource do not exist.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewProjectsClient(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 (*ProjectsClient) GetProject

GetProject retrieves the project identified by the specified name (for example, projects/415104041262).

The caller must have resourcemanager.projects.get permission for this project.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewProjectsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.GetProjectRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#GetProjectRequest.
	}
	resp, err := c.GetProject(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ProjectsClient) ListProjects

ListProjects lists projects that are direct children of the specified folder or organization resource. list() provides a strongly consistent view of the projects underneath the specified parent resource. list() returns projects sorted based upon the (ascending) lexical ordering of their display_name. The caller must have resourcemanager.projects.list permission on the identified parent.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
	"google.golang.org/api/iterator"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewProjectsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

func (*ProjectsClient) MoveProject

MoveProject move a project to another place in your resource hierarchy, under a new resource parent.

Returns an operation which can be used to track the process of the project move workflow. Upon success, the Operation.response field will be populated with the moved project.

The caller must have resourcemanager.projects.update permission on the project and have resourcemanager.projects.move permission on the project’s current and proposed new parent.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewProjectsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.MoveProjectRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#MoveProjectRequest.
	}
	op, err := c.MoveProject(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ProjectsClient) MoveProjectOperation

func (c *ProjectsClient) MoveProjectOperation(name string) *MoveProjectOperation

MoveProjectOperation returns a new MoveProjectOperation from a given name. The name must be that of a previously created MoveProjectOperation, possibly from a different process.

func (*ProjectsClient) SearchProjects

SearchProjects search for projects that the caller has both resourcemanager.projects.get permission on, and also satisfy the specified query.

This method returns projects in an unspecified order.

This method is eventually consistent with project mutations; this means that a newly created project may not appear in the results or recent updates to an existing project may not be reflected in the results. To retrieve the latest state of a project, use the GetProject method.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
	"google.golang.org/api/iterator"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewProjectsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

func (*ProjectsClient) SetIamPolicy

func (c *ProjectsClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

SetIamPolicy sets the IAM access control policy for the specified project.

CAUTION: This method will replace the existing policy, and cannot be used to append additional IAM settings.

Note: Removing service accounts from policies or changing their roles can render services completely inoperable. It is important to understand how the service account is being used before removing or updating its roles.

The following constraints apply when using setIamPolicy():

Project does not support allUsers and allAuthenticatedUsers as
members in a Binding of a Policy.

The owner role can be granted to a user, serviceAccount, or a group
that is part of an organization. For example,
group@myownpersonaldomain.com (at mailto:group@myownpersonaldomain.com) could be added as an owner to a project in
the myownpersonaldomain.com (at http://myownpersonaldomain.com) organization, but not the examplepetstore.com (at http://examplepetstore.com)
organization.

Service accounts can be made owners of a project directly
without any restrictions. However, to be added as an owner, a user must be
invited using the Cloud Platform console and must accept the invitation.

A user cannot be granted the owner role using setIamPolicy(). The user
must be granted the owner role using the Cloud Platform Console and must
explicitly accept the invitation.

Invitations to grant the owner role cannot be sent using
setIamPolicy();
they must be sent only using the Cloud Platform Console.

Membership changes that leave the project without any owners that have
accepted the Terms of Service (ToS) will be rejected.

If the project is not part of an organization, there must be at least
one owner who has accepted the Terms of Service (ToS) agreement in the
policy. Calling setIamPolicy() to remove the last ToS-accepted owner
from the policy will fail. This restriction also applies to legacy
projects that no longer have owners who have accepted the ToS. Edits to
IAM policies will be rejected until the lack of a ToS-accepting owner is
rectified.

Calling this method requires enabling the App Engine Admin API.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewProjectsClient(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 (*ProjectsClient) TestIamPermissions

TestIamPermissions returns permissions that a caller has on the specified project.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewProjectsClient(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 (*ProjectsClient) UndeleteProject

UndeleteProject restores the project identified by the specified name (for example, projects/415104041262). You can only use this method for a project that has a lifecycle state of [DELETE_REQUESTED] [Projects.State.DELETE_REQUESTED]. After deletion starts, the project cannot be restored.

The caller must have resourcemanager.projects.undelete permission for this project.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewProjectsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.UndeleteProjectRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#UndeleteProjectRequest.
	}
	op, err := c.UndeleteProject(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ProjectsClient) UndeleteProjectOperation

func (c *ProjectsClient) UndeleteProjectOperation(name string) *UndeleteProjectOperation

UndeleteProjectOperation returns a new UndeleteProjectOperation from a given name. The name must be that of a previously created UndeleteProjectOperation, possibly from a different process.

func (*ProjectsClient) UpdateProject

UpdateProject updates the display_name and labels of the project identified by the specified name (for example, projects/415104041262). Deleting all labels requires an update mask for labels field.

The caller must have resourcemanager.projects.update permission for this project.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewProjectsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.UpdateProjectRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#UpdateProjectRequest.
	}
	op, err := c.UpdateProject(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ProjectsClient) UpdateProjectOperation

func (c *ProjectsClient) UpdateProjectOperation(name string) *UpdateProjectOperation

UpdateProjectOperation returns a new UpdateProjectOperation from a given name. The name must be that of a previously created UpdateProjectOperation, possibly from a different process.

TagBindingIterator

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

TagBindingIterator manages a stream of *resourcemanagerpb.TagBinding.

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

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

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

TagBindingsCallOptions

type TagBindingsCallOptions struct {
	ListTagBindings  []gax.CallOption
	CreateTagBinding []gax.CallOption
	DeleteTagBinding []gax.CallOption
}

TagBindingsCallOptions contains the retry settings for each method of TagBindingsClient.

TagBindingsClient

type TagBindingsClient struct {

	// The call options for this service.
	CallOptions *TagBindingsCallOptions

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

TagBindingsClient is a client for interacting with Cloud Resource Manager API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Allow users to create and manage TagBindings between TagValues and different cloud resources throughout the GCP resource hierarchy.

func NewTagBindingsClient

func NewTagBindingsClient(ctx context.Context, opts ...option.ClientOption) (*TagBindingsClient, error)

NewTagBindingsClient creates a new tag bindings client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Allow users to create and manage TagBindings between TagValues and different cloud resources throughout the GCP resource hierarchy.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
)

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 := resourcemanager.NewTagBindingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*TagBindingsClient) Close

func (c *TagBindingsClient) Close() error

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

func (*TagBindingsClient) Connection (deprecated)

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

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*TagBindingsClient) CreateTagBinding

CreateTagBinding creates a TagBinding between a TagValue and a cloud resource (currently project, folder, or organization).

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagBindingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.CreateTagBindingRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#CreateTagBindingRequest.
	}
	op, err := c.CreateTagBinding(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*TagBindingsClient) CreateTagBindingOperation

func (c *TagBindingsClient) CreateTagBindingOperation(name string) *CreateTagBindingOperation

CreateTagBindingOperation returns a new CreateTagBindingOperation from a given name. The name must be that of a previously created CreateTagBindingOperation, possibly from a different process.

func (*TagBindingsClient) DeleteTagBinding

DeleteTagBinding deletes a TagBinding.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagBindingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.DeleteTagBindingRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#DeleteTagBindingRequest.
	}
	op, err := c.DeleteTagBinding(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	err = op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*TagBindingsClient) DeleteTagBindingOperation

func (c *TagBindingsClient) DeleteTagBindingOperation(name string) *DeleteTagBindingOperation

DeleteTagBindingOperation returns a new DeleteTagBindingOperation from a given name. The name must be that of a previously created DeleteTagBindingOperation, possibly from a different process.

func (*TagBindingsClient) ListTagBindings

ListTagBindings lists the TagBindings for the given cloud resource, as specified with parent.

NOTE: The parent field is expected to be a full resource name: https://cloud.google.com/apis/design/resource_names#full_resource_name (at https://cloud.google.com/apis/design/resource_names#full_resource_name)

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
	"google.golang.org/api/iterator"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagBindingsClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

TagKeyIterator

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

TagKeyIterator manages a stream of *resourcemanagerpb.TagKey.

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

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

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

TagKeysCallOptions

type TagKeysCallOptions struct {
	ListTagKeys        []gax.CallOption
	GetTagKey          []gax.CallOption
	CreateTagKey       []gax.CallOption
	UpdateTagKey       []gax.CallOption
	DeleteTagKey       []gax.CallOption
	GetIamPolicy       []gax.CallOption
	SetIamPolicy       []gax.CallOption
	TestIamPermissions []gax.CallOption
}

TagKeysCallOptions contains the retry settings for each method of TagKeysClient.

TagKeysClient

type TagKeysClient struct {

	// The call options for this service.
	CallOptions *TagKeysCallOptions

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

TagKeysClient is a client for interacting with Cloud Resource Manager API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Allow users to create and manage tag keys.

func NewTagKeysClient

func NewTagKeysClient(ctx context.Context, opts ...option.ClientOption) (*TagKeysClient, error)

NewTagKeysClient creates a new tag keys client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Allow users to create and manage tag keys.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
)

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 := resourcemanager.NewTagKeysClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*TagKeysClient) Close

func (c *TagKeysClient) Close() error

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

func (*TagKeysClient) Connection (deprecated)

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

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*TagKeysClient) CreateTagKey

CreateTagKey creates a new TagKey. If another request with the same parameters is sent while the original request is in process, the second request will receive an error. A maximum of 300 TagKeys can exist under a parent at any given time.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagKeysClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.CreateTagKeyRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#CreateTagKeyRequest.
	}
	op, err := c.CreateTagKey(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*TagKeysClient) CreateTagKeyOperation

func (c *TagKeysClient) CreateTagKeyOperation(name string) *CreateTagKeyOperation

CreateTagKeyOperation returns a new CreateTagKeyOperation from a given name. The name must be that of a previously created CreateTagKeyOperation, possibly from a different process.

func (*TagKeysClient) DeleteTagKey

DeleteTagKey deletes a TagKey. The TagKey cannot be deleted if it has any child TagValues.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagKeysClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.DeleteTagKeyRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#DeleteTagKeyRequest.
	}
	op, err := c.DeleteTagKey(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*TagKeysClient) DeleteTagKeyOperation

func (c *TagKeysClient) DeleteTagKeyOperation(name string) *DeleteTagKeyOperation

DeleteTagKeyOperation returns a new DeleteTagKeyOperation from a given name. The name must be that of a previously created DeleteTagKeyOperation, possibly from a different process.

func (*TagKeysClient) GetIamPolicy

func (c *TagKeysClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

GetIamPolicy gets the access control policy for a TagKey. The returned policy may be empty if no such policy or resource exists. The resource field should be the TagKey’s resource name. For example, “tagKeys/1234”. The caller must have cloudresourcemanager.googleapis.com/tagKeys.getIamPolicy permission on the specified TagKey.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewTagKeysClient(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 (*TagKeysClient) GetTagKey

GetTagKey retrieves a TagKey. This method will return PERMISSION_DENIED if the key does not exist or the user does not have permission to view it.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagKeysClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.GetTagKeyRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#GetTagKeyRequest.
	}
	resp, err := c.GetTagKey(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*TagKeysClient) ListTagKeys

ListTagKeys lists all TagKeys for a parent resource.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
	"google.golang.org/api/iterator"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagKeysClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

func (*TagKeysClient) SetIamPolicy

func (c *TagKeysClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

SetIamPolicy sets the access control policy on a TagKey, replacing any existing policy. The resource field should be the TagKey’s resource name. For example, “tagKeys/1234”. The caller must have resourcemanager.tagKeys.setIamPolicy permission on the identified tagValue.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewTagKeysClient(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 (*TagKeysClient) TestIamPermissions

TestIamPermissions returns permissions that a caller has on the specified TagKey. The resource field should be the TagKey’s resource name. For example, “tagKeys/1234”.

There are no permissions required for making this API call.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewTagKeysClient(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 (*TagKeysClient) UpdateTagKey

UpdateTagKey updates the attributes of the TagKey resource.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagKeysClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.UpdateTagKeyRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#UpdateTagKeyRequest.
	}
	op, err := c.UpdateTagKey(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*TagKeysClient) UpdateTagKeyOperation

func (c *TagKeysClient) UpdateTagKeyOperation(name string) *UpdateTagKeyOperation

UpdateTagKeyOperation returns a new UpdateTagKeyOperation from a given name. The name must be that of a previously created UpdateTagKeyOperation, possibly from a different process.

TagValueIterator

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

TagValueIterator manages a stream of *resourcemanagerpb.TagValue.

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

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

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

TagValuesCallOptions

type TagValuesCallOptions struct {
	ListTagValues      []gax.CallOption
	GetTagValue        []gax.CallOption
	CreateTagValue     []gax.CallOption
	UpdateTagValue     []gax.CallOption
	DeleteTagValue     []gax.CallOption
	GetIamPolicy       []gax.CallOption
	SetIamPolicy       []gax.CallOption
	TestIamPermissions []gax.CallOption
}

TagValuesCallOptions contains the retry settings for each method of TagValuesClient.

TagValuesClient

type TagValuesClient struct {

	// The call options for this service.
	CallOptions *TagValuesCallOptions

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

TagValuesClient is a client for interacting with Cloud Resource Manager API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Allow users to create and manage tag values.

func NewTagValuesClient

func NewTagValuesClient(ctx context.Context, opts ...option.ClientOption) (*TagValuesClient, error)

NewTagValuesClient creates a new tag values client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.

Allow users to create and manage tag values.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
)

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 := resourcemanager.NewTagValuesClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*TagValuesClient) Close

func (c *TagValuesClient) Close() error

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

func (*TagValuesClient) Connection (deprecated)

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

Connection returns a connection to the API service.

Deprecated: Connections are now pooled so this method does not always return the same resource.

func (*TagValuesClient) CreateTagValue

CreateTagValue creates a TagValue as a child of the specified TagKey. If a another request with the same parameters is sent while the original request is in process the second request will receive an error. A maximum of 300 TagValues can exist under a TagKey at any given time.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagValuesClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.CreateTagValueRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#CreateTagValueRequest.
	}
	op, err := c.CreateTagValue(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*TagValuesClient) CreateTagValueOperation

func (c *TagValuesClient) CreateTagValueOperation(name string) *CreateTagValueOperation

CreateTagValueOperation returns a new CreateTagValueOperation from a given name. The name must be that of a previously created CreateTagValueOperation, possibly from a different process.

func (*TagValuesClient) DeleteTagValue

DeleteTagValue deletes a TagValue. The TagValue cannot have any bindings when it is deleted.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagValuesClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.DeleteTagValueRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#DeleteTagValueRequest.
	}
	op, err := c.DeleteTagValue(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*TagValuesClient) DeleteTagValueOperation

func (c *TagValuesClient) DeleteTagValueOperation(name string) *DeleteTagValueOperation

DeleteTagValueOperation returns a new DeleteTagValueOperation from a given name. The name must be that of a previously created DeleteTagValueOperation, possibly from a different process.

func (*TagValuesClient) GetIamPolicy

func (c *TagValuesClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

GetIamPolicy gets the access control policy for a TagValue. The returned policy may be empty if no such policy or resource exists. The resource field should be the TagValue’s resource name. For example: tagValues/1234. The caller must have the cloudresourcemanager.googleapis.com/tagValues.getIamPolicy permission on the identified TagValue to get the access control policy.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewTagValuesClient(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 (*TagValuesClient) GetTagValue

GetTagValue retrieves TagValue. If the TagValue or namespaced name does not exist, or if the user does not have permission to view it, this method will return PERMISSION_DENIED.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagValuesClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.GetTagValueRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#GetTagValueRequest.
	}
	resp, err := c.GetTagValue(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*TagValuesClient) ListTagValues

ListTagValues lists all TagValues for a specific TagKey.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"
	"google.golang.org/api/iterator"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagValuesClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

func (*TagValuesClient) SetIamPolicy

func (c *TagValuesClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)

SetIamPolicy sets the access control policy on a TagValue, replacing any existing policy. The resource field should be the TagValue’s resource name. For example: tagValues/1234. The caller must have resourcemanager.tagValues.setIamPolicy permission on the identified tagValue.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewTagValuesClient(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 (*TagValuesClient) TestIamPermissions

TestIamPermissions returns permissions that a caller has on the specified TagValue. The resource field should be the TagValue’s resource name. For example: tagValues/1234.

There are no permissions required for making this API call.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

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

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 := resourcemanager.NewTagValuesClient(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 (*TagValuesClient) UpdateTagValue

UpdateTagValue updates the attributes of the TagValue resource.

Example

package main

import (
	"context"

	resourcemanager "cloud.google.com/go/resourcemanager/apiv3"

	resourcemanagerpb "google.golang.org/genproto/googleapis/cloud/resourcemanager/v3"
)

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 := resourcemanager.NewTagValuesClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &resourcemanagerpb.UpdateTagValueRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/resourcemanager/v3#UpdateTagValueRequest.
	}
	op, err := c.UpdateTagValue(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

	resp, err := op.Wait(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*TagValuesClient) UpdateTagValueOperation

func (c *TagValuesClient) UpdateTagValueOperation(name string) *UpdateTagValueOperation

UpdateTagValueOperation returns a new UpdateTagValueOperation from a given name. The name must be that of a previously created UpdateTagValueOperation, possibly from a different process.

UndeleteFolderOperation

type UndeleteFolderOperation struct {
	// contains filtered or unexported fields
}

UndeleteFolderOperation manages a long-running operation from UndeleteFolder.

func (*UndeleteFolderOperation) Done

func (op *UndeleteFolderOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*UndeleteFolderOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*UndeleteFolderOperation) Name

func (op *UndeleteFolderOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*UndeleteFolderOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*UndeleteFolderOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

UndeleteProjectOperation

type UndeleteProjectOperation struct {
	// contains filtered or unexported fields
}

UndeleteProjectOperation manages a long-running operation from UndeleteProject.

func (*UndeleteProjectOperation) Done

func (op *UndeleteProjectOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*UndeleteProjectOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*UndeleteProjectOperation) Name

func (op *UndeleteProjectOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*UndeleteProjectOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*UndeleteProjectOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

UpdateFolderOperation

type UpdateFolderOperation struct {
	// contains filtered or unexported fields
}

UpdateFolderOperation manages a long-running operation from UpdateFolder.

func (*UpdateFolderOperation) Done

func (op *UpdateFolderOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*UpdateFolderOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*UpdateFolderOperation) Name

func (op *UpdateFolderOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*UpdateFolderOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*UpdateFolderOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

UpdateProjectOperation

type UpdateProjectOperation struct {
	// contains filtered or unexported fields
}

UpdateProjectOperation manages a long-running operation from UpdateProject.

func (*UpdateProjectOperation) Done

func (op *UpdateProjectOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*UpdateProjectOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*UpdateProjectOperation) Name

func (op *UpdateProjectOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*UpdateProjectOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*UpdateProjectOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

UpdateTagKeyOperation

type UpdateTagKeyOperation struct {
	// contains filtered or unexported fields
}

UpdateTagKeyOperation manages a long-running operation from UpdateTagKey.

func (*UpdateTagKeyOperation) Done

func (op *UpdateTagKeyOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*UpdateTagKeyOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*UpdateTagKeyOperation) Name

func (op *UpdateTagKeyOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*UpdateTagKeyOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*UpdateTagKeyOperation) Wait