diff --git a/domains/apiv1beta1/doc.go b/domains/apiv1beta1/doc.go new file mode 100644 index 00000000000..1dd61506a09 --- /dev/null +++ b/domains/apiv1beta1/doc.go @@ -0,0 +1,116 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +// Package domains is an auto-generated package for the +// Cloud Domains API. +// +// Enables management and configuration of domain names. +// +// Use of Context +// +// The ctx passed to NewClient is used for authentication requests and +// for creating the underlying connection, but is not used for subsequent calls. +// Individual methods on the client use the ctx given to them. +// +// To close the open connection, use the Close() method. +// +// For information about setting deadlines, reusing contexts, and more +// please visit pkg.go.dev/cloud.google.com/go. +package domains // import "cloud.google.com/go/domains/apiv1beta1" + +import ( + "context" + "os" + "runtime" + "strconv" + "strings" + "unicode" + + "google.golang.org/api/option" + "google.golang.org/grpc/metadata" +) + +// For more information on implementing a client constructor hook, see +// https://github.com/googleapis/google-cloud-go/wiki/Customizing-constructors. +type clientHookParams struct{} +type clientHook func(context.Context, clientHookParams) ([]option.ClientOption, error) + +const versionClient = "20210128" + +func insertMetadata(ctx context.Context, mds ...metadata.MD) context.Context { + out, _ := metadata.FromOutgoingContext(ctx) + out = out.Copy() + for _, md := range mds { + for k, v := range md { + out[k] = append(out[k], v...) + } + } + return metadata.NewOutgoingContext(ctx, out) +} + +func checkDisableDeadlines() (bool, error) { + raw, ok := os.LookupEnv("GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE") + if !ok { + return false, nil + } + + b, err := strconv.ParseBool(raw) + return b, err +} + +// DefaultAuthScopes reports the default set of authentication scopes to use with this package. +func DefaultAuthScopes() []string { + return []string{ + "https://www.googleapis.com/auth/cloud-platform", + } +} + +// versionGo returns the Go runtime version. The returned string +// has no whitespace, suitable for reporting in header. +func versionGo() string { + const develPrefix = "devel +" + + s := runtime.Version() + if strings.HasPrefix(s, develPrefix) { + s = s[len(develPrefix):] + if p := strings.IndexFunc(s, unicode.IsSpace); p >= 0 { + s = s[:p] + } + return s + } + + notSemverRune := func(r rune) bool { + return !strings.ContainsRune("0123456789.", r) + } + + if strings.HasPrefix(s, "go1") { + s = s[2:] + var prerelease string + if p := strings.IndexFunc(s, notSemverRune); p >= 0 { + s, prerelease = s[:p], s[p:] + } + if strings.HasSuffix(s, ".") { + s += "0" + } else if strings.Count(s, ".") < 2 { + s += ".0" + } + if prerelease != "" { + s += "-" + prerelease + } + return s + } + return "UNKNOWN" +} diff --git a/domains/apiv1beta1/domains_client.go b/domains/apiv1beta1/domains_client.go new file mode 100644 index 00000000000..d86a9fb2565 --- /dev/null +++ b/domains/apiv1beta1/domains_client.go @@ -0,0 +1,1010 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package domains + +import ( + "context" + "fmt" + "math" + "net/url" + "time" + + "cloud.google.com/go/longrunning" + lroauto "cloud.google.com/go/longrunning/autogen" + "github.com/golang/protobuf/proto" + gax "github.com/googleapis/gax-go/v2" + "google.golang.org/api/iterator" + "google.golang.org/api/option" + "google.golang.org/api/option/internaloption" + gtransport "google.golang.org/api/transport/grpc" + domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + longrunningpb "google.golang.org/genproto/googleapis/longrunning" + "google.golang.org/grpc" + "google.golang.org/grpc/metadata" +) + +var newClientHook clientHook + +// CallOptions contains the retry settings for each method of Client. +type CallOptions struct { + SearchDomains []gax.CallOption + RetrieveRegisterParameters []gax.CallOption + RegisterDomain []gax.CallOption + ListRegistrations []gax.CallOption + GetRegistration []gax.CallOption + UpdateRegistration []gax.CallOption + ConfigureManagementSettings []gax.CallOption + ConfigureDnsSettings []gax.CallOption + ConfigureContactSettings []gax.CallOption + ExportRegistration []gax.CallOption + DeleteRegistration []gax.CallOption + RetrieveAuthorizationCode []gax.CallOption + ResetAuthorizationCode []gax.CallOption +} + +func defaultClientOptions() []option.ClientOption { + return []option.ClientOption{ + internaloption.WithDefaultEndpoint("domains.googleapis.com:443"), + internaloption.WithDefaultMTLSEndpoint("domains.mtls.googleapis.com:443"), + internaloption.WithDefaultAudience("https://domains.googleapis.com/"), + internaloption.WithDefaultScopes(DefaultAuthScopes()...), + option.WithGRPCDialOption(grpc.WithDisableServiceConfig()), + option.WithGRPCDialOption(grpc.WithDefaultCallOptions( + grpc.MaxCallRecvMsgSize(math.MaxInt32))), + } +} + +func defaultCallOptions() *CallOptions { + return &CallOptions{ + SearchDomains: []gax.CallOption{}, + RetrieveRegisterParameters: []gax.CallOption{}, + RegisterDomain: []gax.CallOption{}, + ListRegistrations: []gax.CallOption{}, + GetRegistration: []gax.CallOption{}, + UpdateRegistration: []gax.CallOption{}, + ConfigureManagementSettings: []gax.CallOption{}, + ConfigureDnsSettings: []gax.CallOption{}, + ConfigureContactSettings: []gax.CallOption{}, + ExportRegistration: []gax.CallOption{}, + DeleteRegistration: []gax.CallOption{}, + RetrieveAuthorizationCode: []gax.CallOption{}, + ResetAuthorizationCode: []gax.CallOption{}, + } +} + +// Client is a client for interacting with Cloud Domains API. +// +// Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls. +type Client struct { + // Connection pool of gRPC connections to the service. + connPool gtransport.ConnPool + + // flag to opt out of default deadlines via GOOGLE_API_GO_EXPERIMENTAL_DISABLE_DEFAULT_DEADLINE + disableDeadlines bool + + // The gRPC API client. + client domainspb.DomainsClient + + // LROClient is used internally to handle longrunning operations. + // It is exposed so that its CallOptions can be modified if required. + // Users should not Close this client. + LROClient *lroauto.OperationsClient + + // The call options for this service. + CallOptions *CallOptions + + // The x-goog-* metadata to be sent with each request. + xGoogMetadata metadata.MD +} + +// NewClient creates a new domains client. +// +// The Cloud Domains API enables management and configuration of domain names. +func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error) { + clientOpts := defaultClientOptions() + + if newClientHook != nil { + hookOpts, err := newClientHook(ctx, clientHookParams{}) + if err != nil { + return nil, err + } + clientOpts = append(clientOpts, hookOpts...) + } + + disableDeadlines, err := checkDisableDeadlines() + if err != nil { + return nil, err + } + + connPool, err := gtransport.DialPool(ctx, append(clientOpts, opts...)...) + if err != nil { + return nil, err + } + c := &Client{ + connPool: connPool, + disableDeadlines: disableDeadlines, + CallOptions: defaultCallOptions(), + + client: domainspb.NewDomainsClient(connPool), + } + c.setGoogleClientInfo() + + c.LROClient, err = lroauto.NewOperationsClient(ctx, gtransport.WithConnPool(connPool)) + if err != nil { + // This error "should not happen", since we are just reusing old connection pool + // and never actually need to dial. + // If this does happen, we could leak connp. However, we cannot close conn: + // If the user invoked the constructor with option.WithGRPCConn, + // we would close a connection that's still in use. + // TODO: investigate error conditions. + return nil, err + } + return c, nil +} + +// Connection returns a connection to the API service. +// +// Deprecated. +func (c *Client) Connection() *grpc.ClientConn { + return c.connPool.Conn() +} + +// Close closes the connection to the API service. The user should invoke this when +// the client is no longer required. +func (c *Client) Close() error { + return c.connPool.Close() +} + +// setGoogleClientInfo sets the name and version of the application in +// the `x-goog-api-client` header passed on each request. Intended for +// use by Google-written clients. +func (c *Client) setGoogleClientInfo(keyval ...string) { + kv := append([]string{"gl-go", versionGo()}, keyval...) + kv = append(kv, "gapic", versionClient, "gax", gax.Version, "grpc", grpc.Version) + c.xGoogMetadata = metadata.Pairs("x-goog-api-client", gax.XGoogHeader(kv...)) +} + +// SearchDomains searches for available domain names similar to the provided query. +// +// Availability results from this method are approximate; call +// RetrieveRegisterParameters on a domain before registering to confirm +// availability. +func (c *Client) SearchDomains(ctx context.Context, req *domainspb.SearchDomainsRequest, opts ...gax.CallOption) (*domainspb.SearchDomainsResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "location", url.QueryEscape(req.GetLocation()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.SearchDomains[0:len(c.CallOptions.SearchDomains):len(c.CallOptions.SearchDomains)], opts...) + var resp *domainspb.SearchDomainsResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.SearchDomains(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// RetrieveRegisterParameters gets parameters needed to register a new domain name, including price and +// up-to-date availability. Use the returned values to call RegisterDomain. +func (c *Client) RetrieveRegisterParameters(ctx context.Context, req *domainspb.RetrieveRegisterParametersRequest, opts ...gax.CallOption) (*domainspb.RetrieveRegisterParametersResponse, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "location", url.QueryEscape(req.GetLocation()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.RetrieveRegisterParameters[0:len(c.CallOptions.RetrieveRegisterParameters):len(c.CallOptions.RetrieveRegisterParameters)], opts...) + var resp *domainspb.RetrieveRegisterParametersResponse + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.RetrieveRegisterParameters(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// RegisterDomain registers a new domain name and creates a corresponding Registration +// resource. +// +// Call RetrieveRegisterParameters first to check availability of the domain +// name and determine parameters like price that are needed to build a call to +// this method. +// +// A successful call creates a Registration resource in state +// REGISTRATION_PENDING, which resolves to ACTIVE within 1-2 +// minutes, indicating that the domain was successfully registered. If the +// resource ends up in state REGISTRATION_FAILED, it indicates that the +// domain was not registered successfully, and you can safely delete the +// resource and retry registration. +func (c *Client) RegisterDomain(ctx context.Context, req *domainspb.RegisterDomainRequest, opts ...gax.CallOption) (*RegisterDomainOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.RegisterDomain[0:len(c.CallOptions.RegisterDomain):len(c.CallOptions.RegisterDomain)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.RegisterDomain(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &RegisterDomainOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// ListRegistrations lists the Registration resources in a project. +func (c *Client) ListRegistrations(ctx context.Context, req *domainspb.ListRegistrationsRequest, opts ...gax.CallOption) *RegistrationIterator { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "parent", url.QueryEscape(req.GetParent()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ListRegistrations[0:len(c.CallOptions.ListRegistrations):len(c.CallOptions.ListRegistrations)], opts...) + it := &RegistrationIterator{} + req = proto.Clone(req).(*domainspb.ListRegistrationsRequest) + it.InternalFetch = func(pageSize int, pageToken string) ([]*domainspb.Registration, string, error) { + var resp *domainspb.ListRegistrationsResponse + req.PageToken = pageToken + if pageSize > math.MaxInt32 { + req.PageSize = math.MaxInt32 + } else { + req.PageSize = int32(pageSize) + } + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ListRegistrations(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, "", err + } + + it.Response = resp + return resp.GetRegistrations(), resp.GetNextPageToken(), nil + } + fetch := func(pageSize int, pageToken string) (string, error) { + items, nextPageToken, err := it.InternalFetch(pageSize, pageToken) + if err != nil { + return "", err + } + it.items = append(it.items, items...) + return nextPageToken, nil + } + it.pageInfo, it.nextFunc = iterator.NewPageInfo(fetch, it.bufLen, it.takeBuf) + it.pageInfo.MaxSize = int(req.GetPageSize()) + it.pageInfo.Token = req.GetPageToken() + return it +} + +// GetRegistration gets the details of a Registration resource. +func (c *Client) GetRegistration(ctx context.Context, req *domainspb.GetRegistrationRequest, opts ...gax.CallOption) (*domainspb.Registration, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.GetRegistration[0:len(c.CallOptions.GetRegistration):len(c.CallOptions.GetRegistration)], opts...) + var resp *domainspb.Registration + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.GetRegistration(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// UpdateRegistration updates select fields of a Registration resource, notably labels. To +// update other fields, use the appropriate custom update method: +// +// To update management settings, see ConfigureManagementSettings +// +// To update DNS configuration, see ConfigureDnsSettings +// +// To update contact information, see ConfigureContactSettings +func (c *Client) UpdateRegistration(ctx context.Context, req *domainspb.UpdateRegistrationRequest, opts ...gax.CallOption) (*UpdateRegistrationOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "registration.name", url.QueryEscape(req.GetRegistration().GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.UpdateRegistration[0:len(c.CallOptions.UpdateRegistration):len(c.CallOptions.UpdateRegistration)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.UpdateRegistration(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &UpdateRegistrationOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// ConfigureManagementSettings updates a Registration's management settings. +func (c *Client) ConfigureManagementSettings(ctx context.Context, req *domainspb.ConfigureManagementSettingsRequest, opts ...gax.CallOption) (*ConfigureManagementSettingsOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "registration", url.QueryEscape(req.GetRegistration()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ConfigureManagementSettings[0:len(c.CallOptions.ConfigureManagementSettings):len(c.CallOptions.ConfigureManagementSettings)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ConfigureManagementSettings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ConfigureManagementSettingsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// ConfigureDnsSettings updates a Registration's DNS settings. +func (c *Client) ConfigureDnsSettings(ctx context.Context, req *domainspb.ConfigureDnsSettingsRequest, opts ...gax.CallOption) (*ConfigureDnsSettingsOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "registration", url.QueryEscape(req.GetRegistration()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ConfigureDnsSettings[0:len(c.CallOptions.ConfigureDnsSettings):len(c.CallOptions.ConfigureDnsSettings)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ConfigureDnsSettings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ConfigureDnsSettingsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// ConfigureContactSettings updates a Registration's contact settings. Some changes require +// confirmation by the domain’s registrant contact . +func (c *Client) ConfigureContactSettings(ctx context.Context, req *domainspb.ConfigureContactSettingsRequest, opts ...gax.CallOption) (*ConfigureContactSettingsOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "registration", url.QueryEscape(req.GetRegistration()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ConfigureContactSettings[0:len(c.CallOptions.ConfigureContactSettings):len(c.CallOptions.ConfigureContactSettings)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ConfigureContactSettings(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ConfigureContactSettingsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// ExportRegistration exports a Registration that you no longer want to use with +// Cloud Domains. You can continue to use the domain in +// Google Domains (at https://domains.google/) until it expires. +// +// If the export is successful: +// +// The resource’s state becomes EXPORTED, meaning that it is no longer +// managed by Cloud Domains +// +// Because individual users can own domains in Google Domains, the calling +// user becomes the domain’s sole owner. Permissions for the domain are +// subsequently managed in Google Domains. +// +// Without further action, the domain does not renew automatically. +// The new owner can set up billing in Google Domains to renew the domain +// if needed. +func (c *Client) ExportRegistration(ctx context.Context, req *domainspb.ExportRegistrationRequest, opts ...gax.CallOption) (*ExportRegistrationOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ExportRegistration[0:len(c.CallOptions.ExportRegistration):len(c.CallOptions.ExportRegistration)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ExportRegistration(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &ExportRegistrationOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// DeleteRegistration deletes a Registration resource. +// +// This method only works on resources in one of the following states: +// +// state is EXPORTED with expire_time in the past +// +// state is REGISTRATION_FAILED +func (c *Client) DeleteRegistration(ctx context.Context, req *domainspb.DeleteRegistrationRequest, opts ...gax.CallOption) (*DeleteRegistrationOperation, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "name", url.QueryEscape(req.GetName()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.DeleteRegistration[0:len(c.CallOptions.DeleteRegistration):len(c.CallOptions.DeleteRegistration)], opts...) + var resp *longrunningpb.Operation + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.DeleteRegistration(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return &DeleteRegistrationOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, resp), + }, nil +} + +// RetrieveAuthorizationCode gets the authorization code of the Registration for the purpose of +// transferring the domain to another registrar. +// +// You can call this method only after 60 days have elapsed since the initial +// domain registration. +func (c *Client) RetrieveAuthorizationCode(ctx context.Context, req *domainspb.RetrieveAuthorizationCodeRequest, opts ...gax.CallOption) (*domainspb.AuthorizationCode, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "registration", url.QueryEscape(req.GetRegistration()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.RetrieveAuthorizationCode[0:len(c.CallOptions.RetrieveAuthorizationCode):len(c.CallOptions.RetrieveAuthorizationCode)], opts...) + var resp *domainspb.AuthorizationCode + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.RetrieveAuthorizationCode(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ResetAuthorizationCode resets the authorization code of the Registration to a new random string. +// +// You can call this method only after 60 days have elapsed since the initial +// domain registration. +func (c *Client) ResetAuthorizationCode(ctx context.Context, req *domainspb.ResetAuthorizationCodeRequest, opts ...gax.CallOption) (*domainspb.AuthorizationCode, error) { + md := metadata.Pairs("x-goog-request-params", fmt.Sprintf("%s=%v", "registration", url.QueryEscape(req.GetRegistration()))) + ctx = insertMetadata(ctx, c.xGoogMetadata, md) + opts = append(c.CallOptions.ResetAuthorizationCode[0:len(c.CallOptions.ResetAuthorizationCode):len(c.CallOptions.ResetAuthorizationCode)], opts...) + var resp *domainspb.AuthorizationCode + err := gax.Invoke(ctx, func(ctx context.Context, settings gax.CallSettings) error { + var err error + resp, err = c.client.ResetAuthorizationCode(ctx, req, settings.GRPC...) + return err + }, opts...) + if err != nil { + return nil, err + } + return resp, nil +} + +// ConfigureContactSettingsOperation manages a long-running operation from ConfigureContactSettings. +type ConfigureContactSettingsOperation struct { + lro *longrunning.Operation +} + +// ConfigureContactSettingsOperation returns a new ConfigureContactSettingsOperation from a given name. +// The name must be that of a previously created ConfigureContactSettingsOperation, possibly from a different process. +func (c *Client) ConfigureContactSettingsOperation(name string) *ConfigureContactSettingsOperation { + return &ConfigureContactSettingsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *ConfigureContactSettingsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*domainspb.Registration, error) { + var resp domainspb.Registration + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *ConfigureContactSettingsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*domainspb.Registration, error) { + var resp domainspb.Registration + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *ConfigureContactSettingsOperation) Metadata() (*domainspb.OperationMetadata, error) { + var meta domainspb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *ConfigureContactSettingsOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *ConfigureContactSettingsOperation) Name() string { + return op.lro.Name() +} + +// ConfigureDnsSettingsOperation manages a long-running operation from ConfigureDnsSettings. +type ConfigureDnsSettingsOperation struct { + lro *longrunning.Operation +} + +// ConfigureDnsSettingsOperation returns a new ConfigureDnsSettingsOperation from a given name. +// The name must be that of a previously created ConfigureDnsSettingsOperation, possibly from a different process. +func (c *Client) ConfigureDnsSettingsOperation(name string) *ConfigureDnsSettingsOperation { + return &ConfigureDnsSettingsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *ConfigureDnsSettingsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*domainspb.Registration, error) { + var resp domainspb.Registration + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *ConfigureDnsSettingsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*domainspb.Registration, error) { + var resp domainspb.Registration + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *ConfigureDnsSettingsOperation) Metadata() (*domainspb.OperationMetadata, error) { + var meta domainspb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *ConfigureDnsSettingsOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *ConfigureDnsSettingsOperation) Name() string { + return op.lro.Name() +} + +// ConfigureManagementSettingsOperation manages a long-running operation from ConfigureManagementSettings. +type ConfigureManagementSettingsOperation struct { + lro *longrunning.Operation +} + +// ConfigureManagementSettingsOperation returns a new ConfigureManagementSettingsOperation from a given name. +// The name must be that of a previously created ConfigureManagementSettingsOperation, possibly from a different process. +func (c *Client) ConfigureManagementSettingsOperation(name string) *ConfigureManagementSettingsOperation { + return &ConfigureManagementSettingsOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *ConfigureManagementSettingsOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*domainspb.Registration, error) { + var resp domainspb.Registration + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *ConfigureManagementSettingsOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*domainspb.Registration, error) { + var resp domainspb.Registration + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *ConfigureManagementSettingsOperation) Metadata() (*domainspb.OperationMetadata, error) { + var meta domainspb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *ConfigureManagementSettingsOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *ConfigureManagementSettingsOperation) Name() string { + return op.lro.Name() +} + +// DeleteRegistrationOperation manages a long-running operation from DeleteRegistration. +type DeleteRegistrationOperation struct { + lro *longrunning.Operation +} + +// DeleteRegistrationOperation returns a new DeleteRegistrationOperation from a given name. +// The name must be that of a previously created DeleteRegistrationOperation, possibly from a different process. +func (c *Client) DeleteRegistrationOperation(name string) *DeleteRegistrationOperation { + return &DeleteRegistrationOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *DeleteRegistrationOperation) Wait(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.WaitWithInterval(ctx, nil, time.Minute, opts...) +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *DeleteRegistrationOperation) Poll(ctx context.Context, opts ...gax.CallOption) error { + return op.lro.Poll(ctx, nil, opts...) +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *DeleteRegistrationOperation) Metadata() (*domainspb.OperationMetadata, error) { + var meta domainspb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *DeleteRegistrationOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *DeleteRegistrationOperation) Name() string { + return op.lro.Name() +} + +// ExportRegistrationOperation manages a long-running operation from ExportRegistration. +type ExportRegistrationOperation struct { + lro *longrunning.Operation +} + +// ExportRegistrationOperation returns a new ExportRegistrationOperation from a given name. +// The name must be that of a previously created ExportRegistrationOperation, possibly from a different process. +func (c *Client) ExportRegistrationOperation(name string) *ExportRegistrationOperation { + return &ExportRegistrationOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *ExportRegistrationOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*domainspb.Registration, error) { + var resp domainspb.Registration + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *ExportRegistrationOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*domainspb.Registration, error) { + var resp domainspb.Registration + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *ExportRegistrationOperation) Metadata() (*domainspb.OperationMetadata, error) { + var meta domainspb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *ExportRegistrationOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *ExportRegistrationOperation) Name() string { + return op.lro.Name() +} + +// RegisterDomainOperation manages a long-running operation from RegisterDomain. +type RegisterDomainOperation struct { + lro *longrunning.Operation +} + +// RegisterDomainOperation returns a new RegisterDomainOperation from a given name. +// The name must be that of a previously created RegisterDomainOperation, possibly from a different process. +func (c *Client) RegisterDomainOperation(name string) *RegisterDomainOperation { + return &RegisterDomainOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *RegisterDomainOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*domainspb.Registration, error) { + var resp domainspb.Registration + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *RegisterDomainOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*domainspb.Registration, error) { + var resp domainspb.Registration + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *RegisterDomainOperation) Metadata() (*domainspb.OperationMetadata, error) { + var meta domainspb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *RegisterDomainOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *RegisterDomainOperation) Name() string { + return op.lro.Name() +} + +// UpdateRegistrationOperation manages a long-running operation from UpdateRegistration. +type UpdateRegistrationOperation struct { + lro *longrunning.Operation +} + +// UpdateRegistrationOperation returns a new UpdateRegistrationOperation from a given name. +// The name must be that of a previously created UpdateRegistrationOperation, possibly from a different process. +func (c *Client) UpdateRegistrationOperation(name string) *UpdateRegistrationOperation { + return &UpdateRegistrationOperation{ + lro: longrunning.InternalNewOperation(c.LROClient, &longrunningpb.Operation{Name: name}), + } +} + +// Wait blocks until the long-running operation is completed, returning the response and any errors encountered. +// +// See documentation of Poll for error-handling information. +func (op *UpdateRegistrationOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*domainspb.Registration, error) { + var resp domainspb.Registration + if err := op.lro.WaitWithInterval(ctx, &resp, time.Minute, opts...); err != nil { + return nil, err + } + return &resp, nil +} + +// Poll fetches the latest state of the long-running operation. +// +// Poll also fetches the latest metadata, which can be retrieved by Metadata. +// +// If Poll fails, the error is returned and op is unmodified. If Poll succeeds and +// the operation has completed with failure, the error is returned and op.Done will return true. +// If Poll succeeds and the operation has completed successfully, +// op.Done will return true, and the response of the operation is returned. +// If Poll succeeds and the operation has not completed, the returned response and error are both nil. +func (op *UpdateRegistrationOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*domainspb.Registration, error) { + var resp domainspb.Registration + if err := op.lro.Poll(ctx, &resp, opts...); err != nil { + return nil, err + } + if !op.Done() { + return nil, nil + } + return &resp, nil +} + +// Metadata returns metadata associated with the long-running operation. +// Metadata itself does not contact the server, but Poll does. +// To get the latest metadata, call this method after a successful call to Poll. +// If the metadata is not available, the returned metadata and error are both nil. +func (op *UpdateRegistrationOperation) Metadata() (*domainspb.OperationMetadata, error) { + var meta domainspb.OperationMetadata + if err := op.lro.Metadata(&meta); err == longrunning.ErrNoMetadata { + return nil, nil + } else if err != nil { + return nil, err + } + return &meta, nil +} + +// Done reports whether the long-running operation has completed. +func (op *UpdateRegistrationOperation) Done() bool { + return op.lro.Done() +} + +// Name returns the name of the long-running operation. +// The name is assigned by the server and is unique within the service from which the operation is created. +func (op *UpdateRegistrationOperation) Name() string { + return op.lro.Name() +} + +// RegistrationIterator manages a stream of *domainspb.Registration. +type RegistrationIterator struct { + items []*domainspb.Registration + pageInfo *iterator.PageInfo + nextFunc func() error + + // 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 []*domainspb.Registration, nextPageToken string, err error) +} + +// PageInfo supports pagination. See the google.golang.org/api/iterator package for details. +func (it *RegistrationIterator) PageInfo() *iterator.PageInfo { + return it.pageInfo +} + +// 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 (it *RegistrationIterator) Next() (*domainspb.Registration, error) { + var item *domainspb.Registration + if err := it.nextFunc(); err != nil { + return item, err + } + item = it.items[0] + it.items = it.items[1:] + return item, nil +} + +func (it *RegistrationIterator) bufLen() int { + return len(it.items) +} + +func (it *RegistrationIterator) takeBuf() interface{} { + b := it.items + it.items = nil + return b +} diff --git a/domains/apiv1beta1/domains_client_example_test.go b/domains/apiv1beta1/domains_client_example_test.go new file mode 100644 index 00000000000..5067d17684b --- /dev/null +++ b/domains/apiv1beta1/domains_client_example_test.go @@ -0,0 +1,335 @@ +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// Code generated by protoc-gen-go_gapic. DO NOT EDIT. + +package domains_test + +import ( + "context" + + domains "cloud.google.com/go/domains/apiv1beta1" + "google.golang.org/api/iterator" + domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" +) + +func ExampleNewClient() { + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use client. + _ = c +} + +func ExampleClient_SearchDomains() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.SearchDomainsRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.SearchDomains(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_RetrieveRegisterParameters() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.RetrieveRegisterParametersRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RetrieveRegisterParameters(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_RegisterDomain() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.RegisterDomainRequest{ + // TODO: Fill request struct fields. + } + op, err := c.RegisterDomain(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ListRegistrations() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + // import "google.golang.org/api/iterator" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.ListRegistrationsRequest{ + // TODO: Fill request struct fields. + } + it := c.ListRegistrations(ctx, req) + for { + resp, err := it.Next() + if err == iterator.Done { + break + } + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp + } +} + +func ExampleClient_GetRegistration() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.GetRegistrationRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.GetRegistration(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_UpdateRegistration() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.UpdateRegistrationRequest{ + // TODO: Fill request struct fields. + } + op, err := c.UpdateRegistration(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ConfigureManagementSettings() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.ConfigureManagementSettingsRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ConfigureManagementSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ConfigureDnsSettings() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.ConfigureDnsSettingsRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ConfigureDnsSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ConfigureContactSettings() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.ConfigureContactSettingsRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ConfigureContactSettings(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ExportRegistration() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.ExportRegistrationRequest{ + // TODO: Fill request struct fields. + } + op, err := c.ExportRegistration(ctx, req) + if err != nil { + // TODO: Handle error. + } + + resp, err := op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_DeleteRegistration() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.DeleteRegistrationRequest{ + // TODO: Fill request struct fields. + } + op, err := c.DeleteRegistration(ctx, req) + if err != nil { + // TODO: Handle error. + } + + err = op.Wait(ctx) + if err != nil { + // TODO: Handle error. + } +} + +func ExampleClient_RetrieveAuthorizationCode() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.RetrieveAuthorizationCodeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.RetrieveAuthorizationCode(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} + +func ExampleClient_ResetAuthorizationCode() { + // import domainspb "google.golang.org/genproto/googleapis/cloud/domains/v1beta1" + + ctx := context.Background() + c, err := domains.NewClient(ctx) + if err != nil { + // TODO: Handle error. + } + + req := &domainspb.ResetAuthorizationCodeRequest{ + // TODO: Fill request struct fields. + } + resp, err := c.ResetAuthorizationCode(ctx, req) + if err != nil { + // TODO: Handle error. + } + // TODO: Use resp. + _ = resp +} diff --git a/internal/.repo-metadata-full.json b/internal/.repo-metadata-full.json index c77336e9c21..283129c3fba 100644 --- a/internal/.repo-metadata-full.json +++ b/internal/.repo-metadata-full.json @@ -375,6 +375,14 @@ "docs_url": "https://pkg.go.dev/cloud.google.com/go/documentai/apiv1beta3", "release_level": "beta" }, + "cloud.google.com/go/domains/apiv1beta1": { + "distribution_name": "cloud.google.com/go/domains/apiv1beta1", + "description": "Cloud Domains API", + "language": "Go", + "client_library_type": "generated", + "docs_url": "https://pkg.go.dev/cloud.google.com/go/domains/apiv1beta1", + "release_level": "beta" + }, "cloud.google.com/go/errorreporting": { "distribution_name": "cloud.google.com/go/errorreporting", "description": "Cloud Error Reporting API", diff --git a/internal/gapicgen/generator/config.go b/internal/gapicgen/generator/config.go index c606aed7403..2106205f5fd 100644 --- a/internal/gapicgen/generator/config.go +++ b/internal/gapicgen/generator/config.go @@ -957,6 +957,14 @@ var microgenGapicConfigs = []*microgenConfig{ // GA after 2021/02/26 releaseLevel: "beta", }, + { + inputDirectoryPath: "google/cloud/domains/v1beta1", + pkg: "domains", + importPath: "cloud.google.com/go/domains/apiv1beta1", + gRPCServiceConfigPath: "google/cloud/domains/v1beta1/domains_grpc_service_config.json", + apiServiceConfigPath: "google/cloud/domains/v1beta1/domains_v1beta1.yaml", + releaseLevel: "beta", + }, // Non-Cloud APIs {