Service Directory API v1beta1 - Package cloud.google.com/go/servicedirectory/apiv1beta1 (v1.1.0)

Package servicedirectory is an auto-generated package for the Service Directory API.

Service Directory is a platform for discovering, publishing, and connecting services.

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

Example usage

To get started with this package, create a client.

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

The client will use your default application credentials. Clients should be reused instead of created as needed. The methods of Client are safe for concurrent use by multiple goroutines. The returned client must be Closed when it is done being used.

Using the Client

The following is an example of making an API call with the newly created client.

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

req := &servicedirectorypb.ResolveServiceRequest{
    // TODO: Fill request struct fields.
    // See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#ResolveServiceRequest.
}
resp, err := c.ResolveService(ctx, req)
if err != nil {
    // TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.

To close the open connection, use the Close() method.

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

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

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

EndpointIterator

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

EndpointIterator manages a stream of *servicedirectorypb.Endpoint.

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

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

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

LookupCallOptions

type LookupCallOptions struct {
	ResolveService []gax.CallOption
}

LookupCallOptions contains the retry settings for each method of LookupClient.

LookupClient

type LookupClient struct {

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

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

Service Directory API for looking up service data at runtime.

func NewLookupClient

func NewLookupClient(ctx context.Context, opts ...option.ClientOption) (*LookupClient, error)

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

Service Directory API for looking up service data at runtime.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
)

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

	// TODO: Use client.
	_ = c
}

func (*LookupClient) Close

func (c *LookupClient) Close() error

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

func (*LookupClient) Connection

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

Connection returns a connection to the API service.

Deprecated.

func (*LookupClient) ResolveService

ResolveService returns a service and its associated endpoints. Resolving a service is not considered an active developer method.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.ResolveServiceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#ResolveServiceRequest.
	}
	resp, err := c.ResolveService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

NamespaceIterator

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

NamespaceIterator manages a stream of *servicedirectorypb.Namespace.

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

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

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

RegistrationCallOptions

type RegistrationCallOptions struct {
	CreateNamespace    []gax.CallOption
	ListNamespaces     []gax.CallOption
	GetNamespace       []gax.CallOption
	UpdateNamespace    []gax.CallOption
	DeleteNamespace    []gax.CallOption
	CreateService      []gax.CallOption
	ListServices       []gax.CallOption
	GetService         []gax.CallOption
	UpdateService      []gax.CallOption
	DeleteService      []gax.CallOption
	CreateEndpoint     []gax.CallOption
	ListEndpoints      []gax.CallOption
	GetEndpoint        []gax.CallOption
	UpdateEndpoint     []gax.CallOption
	DeleteEndpoint     []gax.CallOption
	GetIamPolicy       []gax.CallOption
	SetIamPolicy       []gax.CallOption
	TestIamPermissions []gax.CallOption
}

RegistrationCallOptions contains the retry settings for each method of RegistrationClient.

RegistrationClient

type RegistrationClient struct {

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

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

Service Directory API for registering services. It defines the following resource model:

The API has a collection of Namespace resources, named projects//locations//namespaces/*.

Each Namespace has a collection of Service resources, named projects//locations//namespaces//services/.

Each Service has a collection of Endpoint resources, named projects//locations//namespaces//services//endpoints/*.

func NewRegistrationClient

func NewRegistrationClient(ctx context.Context, opts ...option.ClientOption) (*RegistrationClient, error)

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

Service Directory API for registering services. It defines the following resource model:

The API has a collection of Namespace resources, named projects//locations//namespaces/*.

Each Namespace has a collection of Service resources, named projects//locations//namespaces//services/.

Each Service has a collection of Endpoint resources, named projects//locations//namespaces//services//endpoints/*.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
)

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

	// TODO: Use client.
	_ = c
}

func (*RegistrationClient) Close

func (c *RegistrationClient) Close() error

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

func (*RegistrationClient) Connection

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

Connection returns a connection to the API service.

Deprecated.

func (*RegistrationClient) CreateEndpoint

CreateEndpoint creates an endpoint, and returns the new endpoint.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.CreateEndpointRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#CreateEndpointRequest.
	}
	resp, err := c.CreateEndpoint(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*RegistrationClient) CreateNamespace

CreateNamespace creates a namespace, and returns the new namespace.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.CreateNamespaceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#CreateNamespaceRequest.
	}
	resp, err := c.CreateNamespace(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*RegistrationClient) CreateService

CreateService creates a service, and returns the new service.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.CreateServiceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#CreateServiceRequest.
	}
	resp, err := c.CreateService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*RegistrationClient) DeleteEndpoint

DeleteEndpoint deletes an endpoint.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.DeleteEndpointRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#DeleteEndpointRequest.
	}
	err = c.DeleteEndpoint(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*RegistrationClient) DeleteNamespace

DeleteNamespace deletes a namespace. This also deletes all services and endpoints in the namespace.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.DeleteNamespaceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#DeleteNamespaceRequest.
	}
	err = c.DeleteNamespace(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*RegistrationClient) DeleteService

DeleteService deletes a service. This also deletes all endpoints associated with the service.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.DeleteServiceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#DeleteServiceRequest.
	}
	err = c.DeleteService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}

func (*RegistrationClient) GetEndpoint

GetEndpoint gets an endpoint.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.GetEndpointRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#GetEndpointRequest.
	}
	resp, err := c.GetEndpoint(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*RegistrationClient) GetIamPolicy

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

GetIamPolicy gets the IAM Policy for a resource (namespace or service only).

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

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

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

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

func (*RegistrationClient) GetNamespace

GetNamespace gets a namespace.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.GetNamespaceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#GetNamespaceRequest.
	}
	resp, err := c.GetNamespace(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*RegistrationClient) GetService

GetService gets a service.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.GetServiceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#GetServiceRequest.
	}
	resp, err := c.GetService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*RegistrationClient) ListEndpoints

ListEndpoints lists all endpoints.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
	"google.golang.org/api/iterator"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

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

func (*RegistrationClient) ListNamespaces

ListNamespaces lists all namespaces.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
	"google.golang.org/api/iterator"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

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

func (*RegistrationClient) ListServices

ListServices lists all services belonging to a namespace.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
	"google.golang.org/api/iterator"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.ListServicesRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#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
	}
}

func (*RegistrationClient) SetIamPolicy

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

SetIamPolicy sets the IAM Policy for a resource (namespace or service only).

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

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

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

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

func (*RegistrationClient) TestIamPermissions

TestIamPermissions tests IAM permissions for a resource (namespace or service only).

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

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

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

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

func (*RegistrationClient) UpdateEndpoint

UpdateEndpoint updates an endpoint.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.UpdateEndpointRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#UpdateEndpointRequest.
	}
	resp, err := c.UpdateEndpoint(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*RegistrationClient) UpdateNamespace

UpdateNamespace updates a namespace.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.UpdateNamespaceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#UpdateNamespaceRequest.
	}
	resp, err := c.UpdateNamespace(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

func (*RegistrationClient) UpdateService

UpdateService updates a service.

Example

package main

import (
	"context"

	servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"

	servicedirectorypb "google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1"
)

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

	req := &servicedirectorypb.UpdateServiceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/servicedirectory/v1beta1#UpdateServiceRequest.
	}
	resp, err := c.UpdateService(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}

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

ServiceIterator manages a stream of *servicedirectorypb.Service.

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.