Service Management API v1 - Package cloud.google.com/go/servicemanagement/apiv1 (v1.10.2)

Package servicemanagement is an auto-generated package for the Service Management API.

Google Service Management allows service producers to publish their services on Google Cloud Platform so that they can be discovered and used by service consumers.

General documentation

For information that is relevant for all client libraries please reference https://pkg.go.dev/cloud.google.com/go#pkg-overview. Some information on this page includes:

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

req := &servicemanagementpb.CreateServiceRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#CreateServiceRequest.
}
op, err := c.CreateService(ctx, req)
if err != nil {
    // TODO: Handle error.
}

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

Use of Context

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

CreateServiceOperation

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

CreateServiceOperation manages a long-running operation from CreateService.

func (*CreateServiceOperation) Done

func (op *CreateServiceOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*CreateServiceOperation) 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 (*CreateServiceOperation) Name

func (op *CreateServiceOperation) 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 (*CreateServiceOperation) 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 (*CreateServiceOperation) 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.

CreateServiceRolloutOperation

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

CreateServiceRolloutOperation manages a long-running operation from CreateServiceRollout.

func (*CreateServiceRolloutOperation) Done

Done reports whether the long-running operation has completed.

func (*CreateServiceRolloutOperation) 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 (*CreateServiceRolloutOperation) Name

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 (*CreateServiceRolloutOperation) 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 (*CreateServiceRolloutOperation) 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.

DeleteServiceOperation

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

DeleteServiceOperation manages a long-running operation from DeleteService.

func (*DeleteServiceOperation) Done

func (op *DeleteServiceOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*DeleteServiceOperation) 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 (*DeleteServiceOperation) Name

func (op *DeleteServiceOperation) 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 (*DeleteServiceOperation) Poll

func (op *DeleteServiceOperation) 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 (*DeleteServiceOperation) Wait

func (op *DeleteServiceOperation) 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.

ManagedServiceIterator

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

ManagedServiceIterator manages a stream of *servicemanagementpb.ManagedService.

func (*ManagedServiceIterator) All

func (it *ManagedServiceIterator) All() iter.Seq2[*servicemanagementpb.ManagedService, error]

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

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

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

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

OperationIterator

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

OperationIterator manages a stream of *longrunningpb.Operation.

func (*OperationIterator) All

func (it *OperationIterator) All() iter.Seq2[*longrunningpb.Operation, error]

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

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

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

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

RolloutIterator

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

RolloutIterator manages a stream of *servicemanagementpb.Rollout.

func (*RolloutIterator) All

func (it *RolloutIterator) All() iter.Seq2[*servicemanagementpb.Rollout, error]

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

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

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

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

ServiceIterator

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

ServiceIterator manages a stream of *serviceconfigpb.Service.

func (*ServiceIterator) All

func (it *ServiceIterator) All() iter.Seq2[*serviceconfigpb.Service, error]

All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.

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

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

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

ServiceManagerCallOptions

type ServiceManagerCallOptions struct {
	ListServices         []gax.CallOption
	GetService           []gax.CallOption
	CreateService        []gax.CallOption
	DeleteService        []gax.CallOption
	UndeleteService      []gax.CallOption
	ListServiceConfigs   []gax.CallOption
	GetServiceConfig     []gax.CallOption
	CreateServiceConfig  []gax.CallOption
	SubmitConfigSource   []gax.CallOption
	ListServiceRollouts  []gax.CallOption
	GetServiceRollout    []gax.CallOption
	CreateServiceRollout []gax.CallOption
	GenerateConfigReport []gax.CallOption
	GetIamPolicy         []gax.CallOption
	SetIamPolicy         []gax.CallOption
	TestIamPermissions   []gax.CallOption
	ListOperations       []gax.CallOption
}

ServiceManagerCallOptions contains the retry settings for each method of ServiceManagerClient.

ServiceManagerClient

type ServiceManagerClient struct {

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

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

ServiceManagerClient is a client for interacting with Service Management API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

Google Service Management API (at https://cloud.google.com/service-infrastructure/docs/overview)

func NewServiceManagerClient

func NewServiceManagerClient(ctx context.Context, opts ...option.ClientOption) (*ServiceManagerClient, error)

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

Google Service Management API (at https://cloud.google.com/service-infrastructure/docs/overview)

Example

package main

import (
	"context"

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

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := servicemanagement.NewServiceManagerClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func NewServiceManagerRESTClient

func NewServiceManagerRESTClient(ctx context.Context, opts ...option.ClientOption) (*ServiceManagerClient, error)

NewServiceManagerRESTClient creates a new service manager rest client.

Google Service Management API (at https://cloud.google.com/service-infrastructure/docs/overview)

Example

package main

import (
	"context"

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

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := servicemanagement.NewServiceManagerRESTClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	// TODO: Use client.
	_ = c
}

func (*ServiceManagerClient) Close

func (c *ServiceManagerClient) Close() error

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

func (*ServiceManagerClient) Connection (deprecated)

func (c *ServiceManagerClient) 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 (*ServiceManagerClient) CreateService

CreateService creates a new managed service.

A managed service is immutable, and is subject to mandatory 30-day data retention. You cannot move a service or recreate it within 30 days after deletion.

One producer project can own no more than 500 services. For security and reliability purposes, a production service should be hosted in a dedicated producer project.

Operation<response: ManagedService>

Example

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.CreateServiceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#CreateServiceRequest.
	}
	op, err := c.CreateService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*ServiceManagerClient) CreateServiceConfig

CreateServiceConfig creates a new service configuration (version) for a managed service. This method only stores the service configuration. To roll out the service configuration to backend systems please call CreateServiceRollout.

Only the 100 most recent service configurations and ones referenced by existing rollouts are kept for each service. The rest will be deleted eventually.

Example

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.CreateServiceConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#CreateServiceConfigRequest.
	}
	resp, err := c.CreateServiceConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ServiceManagerClient) CreateServiceOperation

func (c *ServiceManagerClient) CreateServiceOperation(name string) *CreateServiceOperation

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

func (*ServiceManagerClient) CreateServiceRollout

CreateServiceRollout creates a new service configuration rollout. Based on rollout, the Google Service Management will roll out the service configurations to different backend services. For example, the logging configuration will be pushed to Google Cloud Logging.

Please note that any previous pending and running Rollouts and associated Operations will be automatically cancelled so that the latest Rollout will not be blocked by previous Rollouts.

Only the 100 most recent (in any state) and the last 10 successful (if not already part of the set of 100 most recent) rollouts are kept for each service. The rest will be deleted eventually.

Operation<response: Rollout>

Example

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.CreateServiceRolloutRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#CreateServiceRolloutRequest.
	}
	op, err := c.CreateServiceRollout(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*ServiceManagerClient) CreateServiceRolloutOperation

func (c *ServiceManagerClient) CreateServiceRolloutOperation(name string) *CreateServiceRolloutOperation

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

func (*ServiceManagerClient) DeleteService

DeleteService deletes a managed service. This method will change the service to the Soft-Delete state for 30 days. Within this period, service producers may call UndeleteService to restore the service. After 30 days, the service will be permanently deleted.

Operation<response: google.protobuf.Empty>

Example

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.DeleteServiceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#DeleteServiceRequest.
	}
	op, err := c.DeleteService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*ServiceManagerClient) DeleteServiceOperation

func (c *ServiceManagerClient) DeleteServiceOperation(name string) *DeleteServiceOperation

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

func (*ServiceManagerClient) GenerateConfigReport

GenerateConfigReport generates and returns a report (errors, warnings and changes from existing configurations) associated with GenerateConfigReportRequest.new_value

If GenerateConfigReportRequest.old_value is specified, GenerateConfigReportRequest will contain a single ChangeReport based on the comparison between GenerateConfigReportRequest.new_value and GenerateConfigReportRequest.old_value. If GenerateConfigReportRequest.old_value is not specified, this method will compare GenerateConfigReportRequest.new_value with the last pushed service configuration.

Example

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.GenerateConfigReportRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#GenerateConfigReportRequest.
	}
	resp, err := c.GenerateConfigReport(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ServiceManagerClient) GetIamPolicy

func (c *ServiceManagerClient) 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"

	iampb "cloud.google.com/go/iam/apiv1/iampb"

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

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := servicemanagement.NewServiceManagerClient(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 (*ServiceManagerClient) GetService

GetService gets a managed service. Authentication is required unless the service is public.

Example

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.GetServiceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#GetServiceRequest.
	}
	resp, err := c.GetService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ServiceManagerClient) GetServiceConfig

GetServiceConfig gets a service configuration (version) for a managed service.

Example

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.GetServiceConfigRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#GetServiceConfigRequest.
	}
	resp, err := c.GetServiceConfig(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ServiceManagerClient) GetServiceRollout

GetServiceRollout gets a service configuration rollout.

Example

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.GetServiceRolloutRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#GetServiceRolloutRequest.
	}
	resp, err := c.GetServiceRollout(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*ServiceManagerClient) ListOperations

ListOperations lists service operations that match the specified filter in the request.

Examples

package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"

	servicemanagement "cloud.google.com/go/servicemanagement/apiv1"
	"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 := servicemanagement.NewServiceManagerClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	it := c.ListOperations(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*longrunningpb.ListOperationsResponse)
	}
}
all
package main

import (
	"context"

	longrunningpb "cloud.google.com/go/longrunning/autogen/longrunningpb"
	servicemanagement "cloud.google.com/go/servicemanagement/apiv1"
)

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := servicemanagement.NewServiceManagerClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &longrunningpb.ListOperationsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#ListOperationsRequest.
	}
	for resp, err := range c.ListOperations(ctx, req).All() {
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*ServiceManagerClient) ListServiceConfigs

ListServiceConfigs lists the history of the service configuration for a managed service, from the newest to the oldest.

Examples

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
	"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 := servicemanagement.NewServiceManagerClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &servicemanagementpb.ListServiceConfigsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#ListServiceConfigsRequest.
	}
	it := c.ListServiceConfigs(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*servicemanagementpb.ListServiceConfigsResponse)
	}
}
all
package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.ListServiceConfigsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#ListServiceConfigsRequest.
	}
	for resp, err := range c.ListServiceConfigs(ctx, req).All() {
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*ServiceManagerClient) ListServiceRollouts

ListServiceRollouts lists the history of the service configuration rollouts for a managed service, from the newest to the oldest.

Examples

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
	"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 := servicemanagement.NewServiceManagerClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &servicemanagementpb.ListServiceRolloutsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#ListServiceRolloutsRequest.
	}
	it := c.ListServiceRollouts(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*servicemanagementpb.ListServiceRolloutsResponse)
	}
}
all
package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.ListServiceRolloutsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#ListServiceRolloutsRequest.
	}
	for resp, err := range c.ListServiceRollouts(ctx, req).All() {
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*ServiceManagerClient) ListServices

ListServices lists managed services.

Returns all public services. For authenticated users, also returns all services the calling user has “servicemanagement.services.get” permission for.

Examples

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
	"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 := servicemanagement.NewServiceManagerClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &servicemanagementpb.ListServicesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#ListServicesRequest.
	}
	it := c.ListServices(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp

		// If you need to access the underlying RPC response,
		// you can do so by casting the `Response` as below.
		// Otherwise, remove this line. Only populated after
		// first call to Next(). Not safe for concurrent access.
		_ = it.Response.(*servicemanagementpb.ListServicesResponse)
	}
}
all
package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.ListServicesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#ListServicesRequest.
	}
	for resp, err := range c.ListServices(ctx, req).All() {
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}

func (*ServiceManagerClient) SetIamPolicy

func (c *ServiceManagerClient) 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"

	iampb "cloud.google.com/go/iam/apiv1/iampb"

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

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := servicemanagement.NewServiceManagerClient(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 (*ServiceManagerClient) SubmitConfigSource

SubmitConfigSource creates a new service configuration (version) for a managed service based on user-supplied configuration source files (for example: OpenAPI Specification). This method stores the source configurations as well as the generated service configuration. To rollout the service configuration to other services, please call CreateServiceRollout.

Only the 100 most recent configuration sources and ones referenced by existing service configurtions are kept for each service. The rest will be deleted eventually.

Operation<response: SubmitConfigSourceResponse>

Example

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.SubmitConfigSourceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#SubmitConfigSourceRequest.
	}
	op, err := c.SubmitConfigSource(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*ServiceManagerClient) SubmitConfigSourceOperation

func (c *ServiceManagerClient) SubmitConfigSourceOperation(name string) *SubmitConfigSourceOperation

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

func (*ServiceManagerClient) TestIamPermissions

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"

	iampb "cloud.google.com/go/iam/apiv1/iampb"

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

func main() {
	ctx := context.Background()
	// This snippet has been automatically generated and should be regarded as a code template only.
	// It will require modifications to work:
	// - It may require correct/in-range values for request initialization.
	// - It may require specifying regional endpoints when creating the service client as shown in:
	//   https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
	c, err := servicemanagement.NewServiceManagerClient(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 (*ServiceManagerClient) UndeleteService

UndeleteService revives a previously deleted managed service. The method restores the service using the configuration at the time the service was deleted. The target service must exist and must have been deleted within the last 30 days.

Operation<response: UndeleteServiceResponse>

Example

package main

import (
	"context"

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

	servicemanagementpb "cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb"
)

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

	req := &servicemanagementpb.UndeleteServiceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/servicemanagement/apiv1/servicemanagementpb#UndeleteServiceRequest.
	}
	op, err := c.UndeleteService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*ServiceManagerClient) UndeleteServiceOperation

func (c *ServiceManagerClient) UndeleteServiceOperation(name string) *UndeleteServiceOperation

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

SubmitConfigSourceOperation

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

SubmitConfigSourceOperation manages a long-running operation from SubmitConfigSource.

func (*SubmitConfigSourceOperation) Done

func (op *SubmitConfigSourceOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*SubmitConfigSourceOperation) 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 (*SubmitConfigSourceOperation) Name

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 (*SubmitConfigSourceOperation) 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 (*SubmitConfigSourceOperation) 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.

UndeleteServiceOperation

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

UndeleteServiceOperation manages a long-running operation from UndeleteService.

func (*UndeleteServiceOperation) Done

func (op *UndeleteServiceOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*UndeleteServiceOperation) 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 (*UndeleteServiceOperation) Name

func (op *UndeleteServiceOperation) 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 (*UndeleteServiceOperation) 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 (*UndeleteServiceOperation) 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.