Package cloudbuild is an auto-generated package for the Cloud Build API.
Creates and manages builds on Google Cloud Platform.
General documentation
For information about setting deadlines, reusing contexts, and more please visit https://pkg.go.dev/cloud.google.com/go.
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 := cloudbuild.NewRepositoryManagerClient(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 := cloudbuild.NewRepositoryManagerClient(ctx) if err != nil { // TODO: Handle error. } defer c.Close() req := &cloudbuildpb.CreateConnectionRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#CreateConnectionRequest. } op, err := c.CreateConnection(ctx, req) if err != nil { // TODO: Handle error. } resp, err := op.Wait(ctx) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Inspecting errors
To see examples of how to inspect errors returned by this package please reference [Inspecting errors](https://pkg.go.dev/cloud.google.com/go#hdr-Inspecting_errors).
Use of Context
The ctx passed to NewRepositoryManagerClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
BatchCreateRepositoriesOperation
type BatchCreateRepositoriesOperation struct {
// contains filtered or unexported fields
}
BatchCreateRepositoriesOperation manages a long-running operation from BatchCreateRepositories.
func (*BatchCreateRepositoriesOperation) Done
func (op *BatchCreateRepositoriesOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*BatchCreateRepositoriesOperation) Metadata
func (op *BatchCreateRepositoriesOperation) Metadata() (*cloudbuildpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*BatchCreateRepositoriesOperation) Name
func (op *BatchCreateRepositoriesOperation) 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 (*BatchCreateRepositoriesOperation) Poll
func (op *BatchCreateRepositoriesOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.BatchCreateRepositoriesResponse, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds 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 (*BatchCreateRepositoriesOperation) Wait
func (op *BatchCreateRepositoriesOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.BatchCreateRepositoriesResponse, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
ConnectionIterator
type ConnectionIterator 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 []*cloudbuildpb.Connection, nextPageToken string, err error)
// contains filtered or unexported fields
}
ConnectionIterator manages a stream of *cloudbuildpb.Connection.
func (*ConnectionIterator) Next
func (it *ConnectionIterator) Next() (*cloudbuildpb.Connection, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*ConnectionIterator) PageInfo
func (it *ConnectionIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
CreateConnectionOperation
type CreateConnectionOperation struct {
// contains filtered or unexported fields
}
CreateConnectionOperation manages a long-running operation from CreateConnection.
func (*CreateConnectionOperation) Done
func (op *CreateConnectionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateConnectionOperation) Metadata
func (op *CreateConnectionOperation) Metadata() (*cloudbuildpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateConnectionOperation) Name
func (op *CreateConnectionOperation) 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 (*CreateConnectionOperation) Poll
func (op *CreateConnectionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Connection, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds 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 (*CreateConnectionOperation) Wait
func (op *CreateConnectionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Connection, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
CreateRepositoryOperation
type CreateRepositoryOperation struct {
// contains filtered or unexported fields
}
CreateRepositoryOperation manages a long-running operation from CreateRepository.
func (*CreateRepositoryOperation) Done
func (op *CreateRepositoryOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateRepositoryOperation) Metadata
func (op *CreateRepositoryOperation) Metadata() (*cloudbuildpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*CreateRepositoryOperation) Name
func (op *CreateRepositoryOperation) 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 (*CreateRepositoryOperation) Poll
func (op *CreateRepositoryOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Repository, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds 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 (*CreateRepositoryOperation) Wait
func (op *CreateRepositoryOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Repository, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeleteConnectionOperation
type DeleteConnectionOperation struct {
// contains filtered or unexported fields
}
DeleteConnectionOperation manages a long-running operation from DeleteConnection.
func (*DeleteConnectionOperation) Done
func (op *DeleteConnectionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteConnectionOperation) Metadata
func (op *DeleteConnectionOperation) Metadata() (*cloudbuildpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteConnectionOperation) Name
func (op *DeleteConnectionOperation) 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 (*DeleteConnectionOperation) Poll
func (op *DeleteConnectionOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds 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 (*DeleteConnectionOperation) Wait
func (op *DeleteConnectionOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
DeleteRepositoryOperation
type DeleteRepositoryOperation struct {
// contains filtered or unexported fields
}
DeleteRepositoryOperation manages a long-running operation from DeleteRepository.
func (*DeleteRepositoryOperation) Done
func (op *DeleteRepositoryOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteRepositoryOperation) Metadata
func (op *DeleteRepositoryOperation) Metadata() (*cloudbuildpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*DeleteRepositoryOperation) Name
func (op *DeleteRepositoryOperation) 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 (*DeleteRepositoryOperation) Poll
func (op *DeleteRepositoryOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds 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 (*DeleteRepositoryOperation) Wait
func (op *DeleteRepositoryOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.
RepositoryIterator
type RepositoryIterator 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 []*cloudbuildpb.Repository, nextPageToken string, err error)
// contains filtered or unexported fields
}
RepositoryIterator manages a stream of *cloudbuildpb.Repository.
func (*RepositoryIterator) Next
func (it *RepositoryIterator) Next() (*cloudbuildpb.Repository, error)
Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.
func (*RepositoryIterator) PageInfo
func (it *RepositoryIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
RepositoryManagerCallOptions
type RepositoryManagerCallOptions struct {
CreateConnection []gax.CallOption
GetConnection []gax.CallOption
ListConnections []gax.CallOption
UpdateConnection []gax.CallOption
DeleteConnection []gax.CallOption
CreateRepository []gax.CallOption
BatchCreateRepositories []gax.CallOption
GetRepository []gax.CallOption
ListRepositories []gax.CallOption
DeleteRepository []gax.CallOption
FetchReadWriteToken []gax.CallOption
FetchReadToken []gax.CallOption
FetchLinkableRepositories []gax.CallOption
FetchGitRefs []gax.CallOption
GetIamPolicy []gax.CallOption
SetIamPolicy []gax.CallOption
TestIamPermissions []gax.CallOption
CancelOperation []gax.CallOption
GetOperation []gax.CallOption
}
RepositoryManagerCallOptions contains the retry settings for each method of RepositoryManagerClient.
RepositoryManagerClient
type RepositoryManagerClient struct {
// The call options for this service.
CallOptions *RepositoryManagerCallOptions
// 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
}
RepositoryManagerClient is a client for interacting with Cloud Build API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
Manages connections to source code repositories.
func NewRepositoryManagerClient
func NewRepositoryManagerClient(ctx context.Context, opts ...option.ClientOption) (*RepositoryManagerClient, error)
NewRepositoryManagerClient creates a new repository manager client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
Manages connections to source code repositories.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewRepositoryManagerRESTClient
func NewRepositoryManagerRESTClient(ctx context.Context, opts ...option.ClientOption) (*RepositoryManagerClient, error)
NewRepositoryManagerRESTClient creates a new repository manager rest client.
Manages connections to source code repositories.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
)
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 := cloudbuild.NewRepositoryManagerRESTClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func (*RepositoryManagerClient) BatchCreateRepositories
func (c *RepositoryManagerClient) BatchCreateRepositories(ctx context.Context, req *cloudbuildpb.BatchCreateRepositoriesRequest, opts ...gax.CallOption) (*BatchCreateRepositoriesOperation, error)
BatchCreateRepositories creates multiple repositories inside a connection.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.BatchCreateRepositoriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#BatchCreateRepositoriesRequest.
}
op, err := c.BatchCreateRepositories(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) BatchCreateRepositoriesOperation
func (c *RepositoryManagerClient) BatchCreateRepositoriesOperation(name string) *BatchCreateRepositoriesOperation
BatchCreateRepositoriesOperation returns a new BatchCreateRepositoriesOperation from a given name. The name must be that of a previously created BatchCreateRepositoriesOperation, possibly from a different process.
func (*RepositoryManagerClient) CancelOperation
func (c *RepositoryManagerClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error
CancelOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.CancelOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
}
err = c.CancelOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*RepositoryManagerClient) Close
func (c *RepositoryManagerClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*RepositoryManagerClient) Connection (deprecated)
func (c *RepositoryManagerClient) 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 (*RepositoryManagerClient) CreateConnection
func (c *RepositoryManagerClient) CreateConnection(ctx context.Context, req *cloudbuildpb.CreateConnectionRequest, opts ...gax.CallOption) (*CreateConnectionOperation, error)
CreateConnection creates a Connection.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.CreateConnectionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#CreateConnectionRequest.
}
op, err := c.CreateConnection(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) CreateConnectionOperation
func (c *RepositoryManagerClient) CreateConnectionOperation(name string) *CreateConnectionOperation
CreateConnectionOperation returns a new CreateConnectionOperation from a given name. The name must be that of a previously created CreateConnectionOperation, possibly from a different process.
func (*RepositoryManagerClient) CreateRepository
func (c *RepositoryManagerClient) CreateRepository(ctx context.Context, req *cloudbuildpb.CreateRepositoryRequest, opts ...gax.CallOption) (*CreateRepositoryOperation, error)
CreateRepository creates a Repository.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.CreateRepositoryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#CreateRepositoryRequest.
}
op, err := c.CreateRepository(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) CreateRepositoryOperation
func (c *RepositoryManagerClient) CreateRepositoryOperation(name string) *CreateRepositoryOperation
CreateRepositoryOperation returns a new CreateRepositoryOperation from a given name. The name must be that of a previously created CreateRepositoryOperation, possibly from a different process.
func (*RepositoryManagerClient) DeleteConnection
func (c *RepositoryManagerClient) DeleteConnection(ctx context.Context, req *cloudbuildpb.DeleteConnectionRequest, opts ...gax.CallOption) (*DeleteConnectionOperation, error)
DeleteConnection deletes a single connection.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.DeleteConnectionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#DeleteConnectionRequest.
}
op, err := c.DeleteConnection(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*RepositoryManagerClient) DeleteConnectionOperation
func (c *RepositoryManagerClient) DeleteConnectionOperation(name string) *DeleteConnectionOperation
DeleteConnectionOperation returns a new DeleteConnectionOperation from a given name. The name must be that of a previously created DeleteConnectionOperation, possibly from a different process.
func (*RepositoryManagerClient) DeleteRepository
func (c *RepositoryManagerClient) DeleteRepository(ctx context.Context, req *cloudbuildpb.DeleteRepositoryRequest, opts ...gax.CallOption) (*DeleteRepositoryOperation, error)
DeleteRepository deletes a single repository.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.DeleteRepositoryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#DeleteRepositoryRequest.
}
op, err := c.DeleteRepository(ctx, req)
if err != nil {
// TODO: Handle error.
}
err = op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
}
func (*RepositoryManagerClient) DeleteRepositoryOperation
func (c *RepositoryManagerClient) DeleteRepositoryOperation(name string) *DeleteRepositoryOperation
DeleteRepositoryOperation returns a new DeleteRepositoryOperation from a given name. The name must be that of a previously created DeleteRepositoryOperation, possibly from a different process.
func (*RepositoryManagerClient) FetchGitRefs
func (c *RepositoryManagerClient) FetchGitRefs(ctx context.Context, req *cloudbuildpb.FetchGitRefsRequest, opts ...gax.CallOption) (*cloudbuildpb.FetchGitRefsResponse, error)
FetchGitRefs fetch the list of branches or tags for a given repository.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.FetchGitRefsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#FetchGitRefsRequest.
}
resp, err := c.FetchGitRefs(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) FetchLinkableRepositories
func (c *RepositoryManagerClient) FetchLinkableRepositories(ctx context.Context, req *cloudbuildpb.FetchLinkableRepositoriesRequest, opts ...gax.CallOption) *RepositoryIterator
FetchLinkableRepositories fetchLinkableRepositories get repositories from SCM that are accessible and could be added to the connection.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.FetchLinkableRepositoriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#FetchLinkableRepositoriesRequest.
}
it := c.FetchLinkableRepositories(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*RepositoryManagerClient) FetchReadToken
func (c *RepositoryManagerClient) FetchReadToken(ctx context.Context, req *cloudbuildpb.FetchReadTokenRequest, opts ...gax.CallOption) (*cloudbuildpb.FetchReadTokenResponse, error)
FetchReadToken fetches read token of a given repository.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.FetchReadTokenRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#FetchReadTokenRequest.
}
resp, err := c.FetchReadToken(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) FetchReadWriteToken
func (c *RepositoryManagerClient) FetchReadWriteToken(ctx context.Context, req *cloudbuildpb.FetchReadWriteTokenRequest, opts ...gax.CallOption) (*cloudbuildpb.FetchReadWriteTokenResponse, error)
FetchReadWriteToken fetches read/write token of a given repository.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.FetchReadWriteTokenRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#FetchReadWriteTokenRequest.
}
resp, err := c.FetchReadWriteToken(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) GetConnection
func (c *RepositoryManagerClient) GetConnection(ctx context.Context, req *cloudbuildpb.GetConnectionRequest, opts ...gax.CallOption) (*cloudbuildpb.Connection, error)
GetConnection gets details of a single connection.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.GetConnectionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#GetConnectionRequest.
}
resp, err := c.GetConnection(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) GetIamPolicy
func (c *RepositoryManagerClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
GetIamPolicy gets the access control policy for a resource. Returns an empty policy if the resource exists and does not have a policy set.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
iampb "cloud.google.com/go/iam/apiv1/iampb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.GetIamPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#GetIamPolicyRequest.
}
resp, err := c.GetIamPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) GetOperation
func (c *RepositoryManagerClient) GetOperation(ctx context.Context, req *longrunningpb.GetOperationRequest, opts ...gax.CallOption) (*longrunningpb.Operation, error)
GetOperation is a utility method from google.longrunning.Operations.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &longrunningpb.GetOperationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#GetOperationRequest.
}
resp, err := c.GetOperation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) GetRepository
func (c *RepositoryManagerClient) GetRepository(ctx context.Context, req *cloudbuildpb.GetRepositoryRequest, opts ...gax.CallOption) (*cloudbuildpb.Repository, error)
GetRepository gets details of a single repository.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.GetRepositoryRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#GetRepositoryRequest.
}
resp, err := c.GetRepository(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) ListConnections
func (c *RepositoryManagerClient) ListConnections(ctx context.Context, req *cloudbuildpb.ListConnectionsRequest, opts ...gax.CallOption) *ConnectionIterator
ListConnections lists Connections in a given project and location.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.ListConnectionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#ListConnectionsRequest.
}
it := c.ListConnections(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*RepositoryManagerClient) ListRepositories
func (c *RepositoryManagerClient) ListRepositories(ctx context.Context, req *cloudbuildpb.ListRepositoriesRequest, opts ...gax.CallOption) *RepositoryIterator
ListRepositories lists Repositories in a given connection.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
"google.golang.org/api/iterator"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.ListRepositoriesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#ListRepositoriesRequest.
}
it := c.ListRepositories(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*RepositoryManagerClient) SetIamPolicy
func (c *RepositoryManagerClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
SetIamPolicy sets the access control policy on the specified resource. Replaces any existing policy.
Can return NOT_FOUND, INVALID_ARGUMENT, and PERMISSION_DENIED errors.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
iampb "cloud.google.com/go/iam/apiv1/iampb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.SetIamPolicyRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#SetIamPolicyRequest.
}
resp, err := c.SetIamPolicy(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) TestIamPermissions
func (c *RepositoryManagerClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
TestIamPermissions returns permissions that a caller has on the specified resource. If the resource does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
Note: This operation is designed to be used for building permission-aware UIs and command-line tools, not for authorization checking. This operation may “fail open” without warning.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
iampb "cloud.google.com/go/iam/apiv1/iampb"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &iampb.TestIamPermissionsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/iam/apiv1/iampb#TestIamPermissionsRequest.
}
resp, err := c.TestIamPermissions(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) UpdateConnection
func (c *RepositoryManagerClient) UpdateConnection(ctx context.Context, req *cloudbuildpb.UpdateConnectionRequest, opts ...gax.CallOption) (*UpdateConnectionOperation, error)
UpdateConnection updates a single connection.
Example
package main
import (
"context"
cloudbuild "cloud.google.com/go/cloudbuild/apiv2"
cloudbuildpb "cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb"
)
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 := cloudbuild.NewRepositoryManagerClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
req := &cloudbuildpb.UpdateConnectionRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/cloudbuild/apiv2/cloudbuildpb#UpdateConnectionRequest.
}
op, err := c.UpdateConnection(ctx, req)
if err != nil {
// TODO: Handle error.
}
resp, err := op.Wait(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RepositoryManagerClient) UpdateConnectionOperation
func (c *RepositoryManagerClient) UpdateConnectionOperation(name string) *UpdateConnectionOperation
UpdateConnectionOperation returns a new UpdateConnectionOperation from a given name. The name must be that of a previously created UpdateConnectionOperation, possibly from a different process.
UpdateConnectionOperation
type UpdateConnectionOperation struct {
// contains filtered or unexported fields
}
UpdateConnectionOperation manages a long-running operation from UpdateConnection.
func (*UpdateConnectionOperation) Done
func (op *UpdateConnectionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateConnectionOperation) Metadata
func (op *UpdateConnectionOperation) Metadata() (*cloudbuildpb.OperationMetadata, error)
Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.
func (*UpdateConnectionOperation) Name
func (op *UpdateConnectionOperation) 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 (*UpdateConnectionOperation) Poll
func (op *UpdateConnectionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Connection, error)
Poll fetches the latest state of the long-running operation.
Poll also fetches the latest metadata, which can be retrieved by Metadata.
If Poll fails, the error is returned and op is unmodified. If Poll succeeds 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 (*UpdateConnectionOperation) Wait
func (op *UpdateConnectionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*cloudbuildpb.Connection, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.