Package servicedirectory is an auto-generated package for the Service Directory API.
Service Directory is a platform for discovering, publishing, and connecting services.
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 := 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() // 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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#ResolveServiceRequest. } resp, err := c.ResolveService(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Use of Context
The ctx passed to NewLookupClient 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
func (it *EndpointIterator) Next() (*servicedirectorypb.Endpoint, 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 (*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/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 := servicedirectory.NewLookupClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewLookupRESTClient
func NewLookupRESTClient(ctx context.Context, opts ...option.ClientOption) (*LookupClient, error)
NewLookupRESTClient creates a new lookup service rest client.
Service Directory API for looking up service data at runtime.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/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 := servicedirectory.NewLookupRESTClient(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 (deprecated)
func (c *LookupClient) 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 (*LookupClient) ResolveService
func (c *LookupClient) ResolveService(ctx context.Context, req *servicedirectorypb.ResolveServiceRequest, opts ...gax.CallOption) (*servicedirectorypb.ResolveServiceResponse, error)
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/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#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
func (it *NamespaceIterator) Next() (*servicedirectorypb.Namespace, 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 (*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/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 := servicedirectory.NewRegistrationClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
// TODO: Use client.
_ = c
}
func NewRegistrationRESTClient
func NewRegistrationRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegistrationClient, error)
NewRegistrationRESTClient creates a new registration service rest client.
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/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 := servicedirectory.NewRegistrationRESTClient(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 (deprecated)
func (c *RegistrationClient) 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 (*RegistrationClient) CreateEndpoint
func (c *RegistrationClient) CreateEndpoint(ctx context.Context, req *servicedirectorypb.CreateEndpointRequest, opts ...gax.CallOption) (*servicedirectorypb.Endpoint, error)
CreateEndpoint creates a endpoint, and returns the new Endpoint.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#CreateEndpointRequest.
}
resp, err := c.CreateEndpoint(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RegistrationClient) CreateNamespace
func (c *RegistrationClient) CreateNamespace(ctx context.Context, req *servicedirectorypb.CreateNamespaceRequest, opts ...gax.CallOption) (*servicedirectorypb.Namespace, error)
CreateNamespace creates a namespace, and returns the new Namespace.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#CreateNamespaceRequest.
}
resp, err := c.CreateNamespace(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RegistrationClient) CreateService
func (c *RegistrationClient) CreateService(ctx context.Context, req *servicedirectorypb.CreateServiceRequest, opts ...gax.CallOption) (*servicedirectorypb.Service, error)
CreateService creates a service, and returns the new Service.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#CreateServiceRequest.
}
resp, err := c.CreateService(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RegistrationClient) DeleteEndpoint
func (c *RegistrationClient) DeleteEndpoint(ctx context.Context, req *servicedirectorypb.DeleteEndpointRequest, opts ...gax.CallOption) error
DeleteEndpoint deletes a endpoint.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#DeleteEndpointRequest.
}
err = c.DeleteEndpoint(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*RegistrationClient) DeleteNamespace
func (c *RegistrationClient) DeleteNamespace(ctx context.Context, req *servicedirectorypb.DeleteNamespaceRequest, opts ...gax.CallOption) error
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/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#DeleteNamespaceRequest.
}
err = c.DeleteNamespace(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*RegistrationClient) DeleteService
func (c *RegistrationClient) DeleteService(ctx context.Context, req *servicedirectorypb.DeleteServiceRequest, opts ...gax.CallOption) error
DeleteService deletes a service. This also deletes all endpoints associated with the service.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#DeleteServiceRequest.
}
err = c.DeleteService(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*RegistrationClient) GetEndpoint
func (c *RegistrationClient) GetEndpoint(ctx context.Context, req *servicedirectorypb.GetEndpointRequest, opts ...gax.CallOption) (*servicedirectorypb.Endpoint, error)
GetEndpoint gets a endpoint.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#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/apiv1"
iampb "google.golang.org/genproto/googleapis/iam/v1"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := 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
func (c *RegistrationClient) GetNamespace(ctx context.Context, req *servicedirectorypb.GetNamespaceRequest, opts ...gax.CallOption) (*servicedirectorypb.Namespace, error)
GetNamespace gets a namespace.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#GetNamespaceRequest.
}
resp, err := c.GetNamespace(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RegistrationClient) GetService
func (c *RegistrationClient) GetService(ctx context.Context, req *servicedirectorypb.GetServiceRequest, opts ...gax.CallOption) (*servicedirectorypb.Service, error)
GetService gets a service.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#GetServiceRequest.
}
resp, err := c.GetService(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RegistrationClient) ListEndpoints
func (c *RegistrationClient) ListEndpoints(ctx context.Context, req *servicedirectorypb.ListEndpointsRequest, opts ...gax.CallOption) *EndpointIterator
ListEndpoints lists all endpoints.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
"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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#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
func (c *RegistrationClient) ListNamespaces(ctx context.Context, req *servicedirectorypb.ListNamespacesRequest, opts ...gax.CallOption) *NamespaceIterator
ListNamespaces lists all namespaces.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
"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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#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
func (c *RegistrationClient) ListServices(ctx context.Context, req *servicedirectorypb.ListServicesRequest, opts ...gax.CallOption) *ServiceIterator
ListServices lists all services belonging to a namespace.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
"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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#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/apiv1"
iampb "google.golang.org/genproto/googleapis/iam/v1"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := 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
func (c *RegistrationClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
TestIamPermissions tests IAM permissions for a resource (namespace or service only).
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
iampb "google.golang.org/genproto/googleapis/iam/v1"
)
func main() {
ctx := context.Background()
// This snippet has been automatically generated and should be regarded as a code template only.
// It will require modifications to work:
// - It may require correct/in-range values for request initialization.
// - It may require specifying regional endpoints when creating the service client as shown in:
// https://pkg.go.dev/cloud.google.com/go#hdr-Client_Options
c, err := 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
func (c *RegistrationClient) UpdateEndpoint(ctx context.Context, req *servicedirectorypb.UpdateEndpointRequest, opts ...gax.CallOption) (*servicedirectorypb.Endpoint, error)
UpdateEndpoint updates a endpoint.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#UpdateEndpointRequest.
}
resp, err := c.UpdateEndpoint(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RegistrationClient) UpdateNamespace
func (c *RegistrationClient) UpdateNamespace(ctx context.Context, req *servicedirectorypb.UpdateNamespaceRequest, opts ...gax.CallOption) (*servicedirectorypb.Namespace, error)
UpdateNamespace updates a namespace.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#UpdateNamespaceRequest.
}
resp, err := c.UpdateNamespace(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*RegistrationClient) UpdateService
func (c *RegistrationClient) UpdateService(ctx context.Context, req *servicedirectorypb.UpdateServiceRequest, opts ...gax.CallOption) (*servicedirectorypb.Service, error)
UpdateService updates a service.
Example
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb"
)
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 := 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/cloud.google.com/go/servicedirectory/apiv1/servicedirectorypb#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
func (it *ServiceIterator) Next() (*servicedirectorypb.Service, 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 (*ServiceIterator) PageInfo
func (it *ServiceIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.