package servicedirectory
import "cloud.google.com/go/servicedirectory/apiv1beta1"
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.
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:
- Authentication and Authorization
- Timeouts and Cancellation
- Testing against Client Libraries
- Debugging Client Libraries
- Inspecting errors
Example usage
To get started with this package, create a client.
// go get cloud.google.com/go/servicedirectory/apiv1beta1@latest 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, mentioned above.
req := &servicedirectorypb.ResolveServiceRequest{ // TODO: Fill request struct fields. // See https://pkg.go.dev/cloud.google.com/go/servicedirectory/apiv1beta1/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.
Index ¶
- func DefaultAuthScopes() []string
- type EndpointIterator
- func (it *EndpointIterator) All() iter.Seq2[*servicedirectorypb.Endpoint, error]
- func (it *EndpointIterator) Next() (*servicedirectorypb.Endpoint, error)
- func (it *EndpointIterator) PageInfo() *iterator.PageInfo
- type LocationIterator
- func (it *LocationIterator) All() iter.Seq2[*locationpb.Location, error]
- func (it *LocationIterator) Next() (*locationpb.Location, error)
- func (it *LocationIterator) PageInfo() *iterator.PageInfo
- type LookupCallOptions
- type LookupClient
- func NewLookupClient(ctx context.Context, opts ...option.ClientOption) (*LookupClient, error)
- func NewLookupRESTClient(ctx context.Context, opts ...option.ClientOption) (*LookupClient, error)
- func (c *LookupClient) Close() error
- func (c *LookupClient) Connection() *grpc.ClientConn
- func (c *LookupClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
- func (c *LookupClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
- func (c *LookupClient) ResolveService(ctx context.Context, req *servicedirectorypb.ResolveServiceRequest, opts ...gax.CallOption) (*servicedirectorypb.ResolveServiceResponse, error)
- type NamespaceIterator
- func (it *NamespaceIterator) All() iter.Seq2[*servicedirectorypb.Namespace, error]
- func (it *NamespaceIterator) Next() (*servicedirectorypb.Namespace, error)
- func (it *NamespaceIterator) PageInfo() *iterator.PageInfo
- type RegistrationCallOptions
- type RegistrationClient
- func NewRegistrationClient(ctx context.Context, opts ...option.ClientOption) (*RegistrationClient, error)
- func NewRegistrationRESTClient(ctx context.Context, opts ...option.ClientOption) (*RegistrationClient, error)
- func (c *RegistrationClient) Close() error
- func (c *RegistrationClient) Connection() *grpc.ClientConn
- func (c *RegistrationClient) CreateEndpoint(ctx context.Context, req *servicedirectorypb.CreateEndpointRequest, opts ...gax.CallOption) (*servicedirectorypb.Endpoint, error)
- func (c *RegistrationClient) CreateNamespace(ctx context.Context, req *servicedirectorypb.CreateNamespaceRequest, opts ...gax.CallOption) (*servicedirectorypb.Namespace, error)
- func (c *RegistrationClient) CreateService(ctx context.Context, req *servicedirectorypb.CreateServiceRequest, opts ...gax.CallOption) (*servicedirectorypb.Service, error)
- func (c *RegistrationClient) DeleteEndpoint(ctx context.Context, req *servicedirectorypb.DeleteEndpointRequest, opts ...gax.CallOption) error
- func (c *RegistrationClient) DeleteNamespace(ctx context.Context, req *servicedirectorypb.DeleteNamespaceRequest, opts ...gax.CallOption) error
- func (c *RegistrationClient) DeleteService(ctx context.Context, req *servicedirectorypb.DeleteServiceRequest, opts ...gax.CallOption) error
- func (c *RegistrationClient) GetEndpoint(ctx context.Context, req *servicedirectorypb.GetEndpointRequest, opts ...gax.CallOption) (*servicedirectorypb.Endpoint, error)
- func (c *RegistrationClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *RegistrationClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
- func (c *RegistrationClient) GetNamespace(ctx context.Context, req *servicedirectorypb.GetNamespaceRequest, opts ...gax.CallOption) (*servicedirectorypb.Namespace, error)
- func (c *RegistrationClient) GetService(ctx context.Context, req *servicedirectorypb.GetServiceRequest, opts ...gax.CallOption) (*servicedirectorypb.Service, error)
- func (c *RegistrationClient) ListEndpoints(ctx context.Context, req *servicedirectorypb.ListEndpointsRequest, opts ...gax.CallOption) *EndpointIterator
- func (c *RegistrationClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
- func (c *RegistrationClient) ListNamespaces(ctx context.Context, req *servicedirectorypb.ListNamespacesRequest, opts ...gax.CallOption) *NamespaceIterator
- func (c *RegistrationClient) ListServices(ctx context.Context, req *servicedirectorypb.ListServicesRequest, opts ...gax.CallOption) *ServiceIterator
- func (c *RegistrationClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *RegistrationClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
- func (c *RegistrationClient) UpdateEndpoint(ctx context.Context, req *servicedirectorypb.UpdateEndpointRequest, opts ...gax.CallOption) (*servicedirectorypb.Endpoint, error)
- func (c *RegistrationClient) UpdateNamespace(ctx context.Context, req *servicedirectorypb.UpdateNamespaceRequest, opts ...gax.CallOption) (*servicedirectorypb.Namespace, error)
- func (c *RegistrationClient) UpdateService(ctx context.Context, req *servicedirectorypb.UpdateServiceRequest, opts ...gax.CallOption) (*servicedirectorypb.Service, error)
- type ServiceIterator
Examples ¶
- LookupClient.GetLocation
- LookupClient.ListLocations
- LookupClient.ListLocations (All)
- LookupClient.ResolveService
- NewLookupClient
- NewLookupRESTClient
- NewRegistrationClient
- NewRegistrationRESTClient
- RegistrationClient.CreateEndpoint
- RegistrationClient.CreateNamespace
- RegistrationClient.CreateService
- RegistrationClient.DeleteEndpoint
- RegistrationClient.DeleteNamespace
- RegistrationClient.DeleteService
- RegistrationClient.GetEndpoint
- RegistrationClient.GetIamPolicy
- RegistrationClient.GetLocation
- RegistrationClient.GetNamespace
- RegistrationClient.GetService
- RegistrationClient.ListEndpoints
- RegistrationClient.ListEndpoints (All)
- RegistrationClient.ListLocations
- RegistrationClient.ListLocations (All)
- RegistrationClient.ListNamespaces
- RegistrationClient.ListNamespaces (All)
- RegistrationClient.ListServices
- RegistrationClient.ListServices (All)
- RegistrationClient.SetIamPolicy
- RegistrationClient.TestIamPermissions
- RegistrationClient.UpdateEndpoint
- RegistrationClient.UpdateNamespace
- RegistrationClient.UpdateService
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type 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) All ¶
func (it *EndpointIterator) All() iter.Seq2[*servicedirectorypb.Endpoint, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
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.
type LocationIterator ¶
type LocationIterator 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 []*locationpb.Location, nextPageToken string, err error) // contains filtered or unexported fields }
LocationIterator manages a stream of *locationpb.Location.
func (*LocationIterator) All ¶
func (it *LocationIterator) All() iter.Seq2[*locationpb.Location, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
func (*LocationIterator) Next ¶
func (it *LocationIterator) Next() (*locationpb.Location, 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 (*LocationIterator) PageInfo ¶
func (it *LocationIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type LookupCallOptions ¶
type LookupCallOptions struct { ResolveService []gax.CallOption GetLocation []gax.CallOption ListLocations []gax.CallOption }
LookupCallOptions contains the retry settings for each method of LookupClient.
type 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.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
)
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.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
)
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 ¶
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) GetLocation ¶
func (c *LookupClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*LookupClient) ListLocations ¶
func (c *LookupClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Code:play
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(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.(*locationpb.ListLocationsResponse)
}
}
Example (All)¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
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.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/servicedirectorypb#ResolveServiceRequest.
}
resp, err := c.ResolveService(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type 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) All ¶
func (it *NamespaceIterator) All() iter.Seq2[*servicedirectorypb.Namespace, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
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.
type 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 GetLocation []gax.CallOption ListLocations []gax.CallOption }
RegistrationCallOptions contains the retry settings for each method of RegistrationClient.
type 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¶
Code:play
package main import ( "context" servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1" ) 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¶
Code:play
package main import ( "context" servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1" ) 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 ¶
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 an endpoint, and returns the new endpoint.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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 an endpoint.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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 an endpoint.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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
Code:play
Example¶
package main
import (
"context"
iampb "cloud.google.com/go/iam/apiv1/iampb"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
)
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/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 (*RegistrationClient) GetLocation ¶
func (c *RegistrationClient) GetLocation(ctx context.Context, req *locationpb.GetLocationRequest, opts ...gax.CallOption) (*locationpb.Location, error)
GetLocation gets information about a location.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := &locationpb.GetLocationRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#GetLocationRequest.
}
resp, err := c.GetLocation(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.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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.
Code:play
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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
// 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.(*servicedirectorypb.ListEndpointsResponse)
}
}
Example (All)¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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.ListEndpointsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/servicedirectory/apiv1beta1/servicedirectorypb#ListEndpointsRequest.
}
for resp, err := range c.ListEndpoints(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any error.
}
// TODO: Use resp.
_ = resp
}
}
func (*RegistrationClient) ListLocations ¶
func (c *RegistrationClient) ListLocations(ctx context.Context, req *locationpb.ListLocationsRequest, opts ...gax.CallOption) *LocationIterator
ListLocations lists information about the supported locations for this service.
Code:play
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
"google.golang.org/api/iterator"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
it := c.ListLocations(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.(*locationpb.ListLocationsResponse)
}
}
Example (All)¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
locationpb "google.golang.org/genproto/googleapis/cloud/location"
)
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 := &locationpb.ListLocationsRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/google.golang.org/genproto/googleapis/cloud/location#ListLocationsRequest.
}
for resp, err := range c.ListLocations(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any 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.
Code:play
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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
// 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.(*servicedirectorypb.ListNamespacesResponse)
}
}
Example (All)¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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.ListNamespacesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/servicedirectory/apiv1beta1/servicedirectorypb#ListNamespacesRequest.
}
for resp, err := range c.ListNamespaces(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any 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.
Code:play
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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
// 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.(*servicedirectorypb.ListServicesResponse)
}
}
Example (All)¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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.ListServicesRequest{
// TODO: Fill request struct fields.
// See https://pkg.go.dev/cloud.google.com/go/servicedirectory/apiv1beta1/servicedirectorypb#ListServicesRequest.
}
for resp, err := range c.ListServices(ctx, req).All() {
if err != nil {
// TODO: Handle error and break/return/continue. Iteration will stop after any 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
Code:play
Example¶
package main
import (
"context"
iampb "cloud.google.com/go/iam/apiv1/iampb"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
)
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/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 (*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, service or
service workload only).
Code:play
Example¶
package main
import (
"context"
iampb "cloud.google.com/go/iam/apiv1/iampb"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
)
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/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 (*RegistrationClient) UpdateEndpoint ¶
func (c *RegistrationClient) UpdateEndpoint(ctx context.Context, req *servicedirectorypb.UpdateEndpointRequest, opts ...gax.CallOption) (*servicedirectorypb.Endpoint, error)
UpdateEndpoint updates an endpoint.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/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.
Code:play
Example¶
package main
import (
"context"
servicedirectory "cloud.google.com/go/servicedirectory/apiv1beta1"
servicedirectorypb "cloud.google.com/go/servicedirectory/apiv1beta1/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/apiv1beta1/servicedirectorypb#UpdateServiceRequest.
}
resp, err := c.UpdateService(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
type 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) All ¶
func (it *ServiceIterator) All() iter.Seq2[*servicedirectorypb.Service, error]
All returns an iterator. If an error is returned by the iterator, the iterator will stop after that iteration.
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.
Source Files ¶
auxiliary.go auxiliary_go123.go doc.go helpers.go lookup_client.go registration_client.go version.go
Directories ¶
Path | Synopsis |
---|---|
apiv1beta1/servicedirectorypb |
- Version
- v1.12.3 (latest)
- Published
- Jan 2, 2025
- Platform
- linux/amd64
- Imports
- 28 packages
- Last checked
- 5 days ago –
Tools for package owners.