client

package
v0.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 15, 2024 License: Apache-2.0 Imports: 30 Imported by: 1

Documentation

Overview

Package client is an auto-generated package for the Client Libraries Showcase API.

Showcase represents both a model API and an integration testing surface for client library generator consumption.

General documentation

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

Example usage

To get started with this package, create a client.

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

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

Using the Client

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

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

req := &genprotopb.EnumRequest{
	// TODO: Fill request struct fields.
	// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#EnumRequest.
}
resp, err := c.GetEnum(ctx, req)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

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

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultAuthScopes

func DefaultAuthScopes() []string

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

Types

type BlurbIterator

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

BlurbIterator manages a stream of *genprotopb.Blurb.

func (*BlurbIterator) Next

func (it *BlurbIterator) Next() (*genprotopb.Blurb, 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 (*BlurbIterator) PageInfo

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

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

type ComplianceCallOptions added in v0.13.0

type ComplianceCallOptions struct {
	RepeatDataBody                 []gax.CallOption
	RepeatDataBodyInfo             []gax.CallOption
	RepeatDataQuery                []gax.CallOption
	RepeatDataSimplePath           []gax.CallOption
	RepeatDataPathResource         []gax.CallOption
	RepeatDataPathTrailingResource []gax.CallOption
	RepeatDataBodyPut              []gax.CallOption
	RepeatDataBodyPatch            []gax.CallOption
	GetEnum                        []gax.CallOption
	VerifyEnum                     []gax.CallOption
	ListLocations                  []gax.CallOption
	GetLocation                    []gax.CallOption
	SetIamPolicy                   []gax.CallOption
	GetIamPolicy                   []gax.CallOption
	TestIamPermissions             []gax.CallOption
	ListOperations                 []gax.CallOption
	GetOperation                   []gax.CallOption
	DeleteOperation                []gax.CallOption
	CancelOperation                []gax.CallOption
}

ComplianceCallOptions contains the retry settings for each method of ComplianceClient.

type ComplianceClient added in v0.13.0

type ComplianceClient struct {

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

ComplianceClient is a client for interacting with Client Libraries Showcase API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped correctly.

func NewComplianceClient added in v0.13.0

func NewComplianceClient(ctx context.Context, opts ...option.ClientOption) (*ComplianceClient, error)

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

This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped correctly.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
)

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

	// TODO: Use client.
	_ = c
}
Output:

func NewComplianceRESTClient added in v0.19.0

func NewComplianceRESTClient(ctx context.Context, opts ...option.ClientOption) (*ComplianceClient, error)

NewComplianceRESTClient creates a new compliance rest client.

This service is used to test that GAPICs implement various REST-related features correctly. This mostly means transcoding proto3 requests to REST format correctly for various types of HTTP annotations, but it also includes verifying that unknown (numeric) enums received by clients can be round-tripped correctly.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
)

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

	// TODO: Use client.
	_ = c
}
Output:

func (*ComplianceClient) CancelOperation added in v0.14.0

CancelOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

	req := &longrunningpb.CancelOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
	}
	err = c.CancelOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*ComplianceClient) Close added in v0.13.0

func (c *ComplianceClient) Close() error

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

func (*ComplianceClient) Connection deprecated added in v0.13.0

func (c *ComplianceClient) 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 (*ComplianceClient) DeleteOperation added in v0.14.0

DeleteOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

	req := &longrunningpb.DeleteOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
	}
	err = c.DeleteOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*ComplianceClient) GetEnum added in v0.24.0

GetEnum this method requests an enum value from the server. Depending on the contents of EnumRequest, the enum value returned will be a known enum declared in the .proto file, or a made-up enum value the is unknown to the client. To verify that clients can round-trip unknown enum vaues they receive, use the response from this RPC as the request to VerifyEnum()

The values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run (this is needed for VerifyEnum() to work) but are not guaranteed to be the same across separate Showcase server runs.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.EnumRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#EnumRequest.
	}
	resp, err := c.GetEnum(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ComplianceClient) GetIamPolicy added in v0.14.0

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

GetIamPolicy is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewComplianceClient(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
}
Output:

func (*ComplianceClient) GetLocation added in v0.14.0

GetLocation is a utility method from google.cloud.location.Locations.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	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 := client.NewComplianceClient(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
}
Output:

func (*ComplianceClient) GetOperation added in v0.14.0

GetOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

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

func (*ComplianceClient) ListLocations added in v0.14.0

ListLocations is a utility method from google.cloud.location.Locations.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
	"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 := client.NewComplianceClient(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)
	}
}
Output:

func (*ComplianceClient) ListOperations added in v0.14.0

ListOperations is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
	"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 := client.NewComplianceClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

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

func (*ComplianceClient) RepeatDataBody added in v0.13.0

RepeatDataBody this method echoes the ComplianceData request. This method exercises sending the entire request object in the REST body.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.RepeatRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#RepeatRequest.
	}
	resp, err := c.RepeatDataBody(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ComplianceClient) RepeatDataBodyInfo added in v0.13.0

func (c *ComplianceClient) RepeatDataBodyInfo(ctx context.Context, req *genprotopb.RepeatRequest, opts ...gax.CallOption) (*genprotopb.RepeatResponse, error)

RepeatDataBodyInfo this method echoes the ComplianceData request. This method exercises sending the a message-type field in the REST body. Per AIP-127, only top-level, non-repeated fields can be sent this way.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.RepeatRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#RepeatRequest.
	}
	resp, err := c.RepeatDataBodyInfo(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ComplianceClient) RepeatDataBodyPatch added in v0.17.0

func (c *ComplianceClient) RepeatDataBodyPatch(ctx context.Context, req *genprotopb.RepeatRequest, opts ...gax.CallOption) (*genprotopb.RepeatResponse, error)

RepeatDataBodyPatch this method echoes the ComplianceData request, using the HTTP PATCH method.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.RepeatRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#RepeatRequest.
	}
	resp, err := c.RepeatDataBodyPatch(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ComplianceClient) RepeatDataBodyPut added in v0.17.0

RepeatDataBodyPut this method echoes the ComplianceData request, using the HTTP PUT method.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.RepeatRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#RepeatRequest.
	}
	resp, err := c.RepeatDataBodyPut(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ComplianceClient) RepeatDataPathResource added in v0.13.0

func (c *ComplianceClient) RepeatDataPathResource(ctx context.Context, req *genprotopb.RepeatRequest, opts ...gax.CallOption) (*genprotopb.RepeatResponse, error)

RepeatDataPathResource same as RepeatDataSimplePath, but with a path resource.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.RepeatRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#RepeatRequest.
	}
	resp, err := c.RepeatDataPathResource(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ComplianceClient) RepeatDataPathTrailingResource added in v0.13.0

func (c *ComplianceClient) RepeatDataPathTrailingResource(ctx context.Context, req *genprotopb.RepeatRequest, opts ...gax.CallOption) (*genprotopb.RepeatResponse, error)

RepeatDataPathTrailingResource same as RepeatDataSimplePath, but with a trailing resource.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.RepeatRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#RepeatRequest.
	}
	resp, err := c.RepeatDataPathTrailingResource(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ComplianceClient) RepeatDataQuery added in v0.13.0

RepeatDataQuery this method echoes the ComplianceData request. This method exercises sending all request fields as query parameters.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.RepeatRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#RepeatRequest.
	}
	resp, err := c.RepeatDataQuery(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ComplianceClient) RepeatDataSimplePath added in v0.13.0

func (c *ComplianceClient) RepeatDataSimplePath(ctx context.Context, req *genprotopb.RepeatRequest, opts ...gax.CallOption) (*genprotopb.RepeatResponse, error)

RepeatDataSimplePath this method echoes the ComplianceData request. This method exercises sending some parameters as “simple” path variables (i.e., of the form “/bar/{foo}” rather than “/{foo=bar/*}”), and the rest as query parameters.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.RepeatRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#RepeatRequest.
	}
	resp, err := c.RepeatDataSimplePath(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*ComplianceClient) SetIamPolicy added in v0.14.0

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

SetIamPolicy is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewComplianceClient(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
}
Output:

func (*ComplianceClient) TestIamPermissions added in v0.14.0

TestIamPermissions is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewComplianceClient(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
}
Output:

func (*ComplianceClient) VerifyEnum added in v0.24.0

VerifyEnum this method is used to verify that clients can round-trip enum values, which is particularly important for unknown enum values over REST. VerifyEnum() verifies that its request, which is presumably the response that the client previously got to a GetEnum(), contains the correct data. If so, it responds with the same EnumResponse; otherwise, the RPC errors.

This works because the values of enums sent by the server when a known or unknown value is requested will be the same within a single Showcase server run, although they are not guaranteed to be the same across separate Showcase server runs.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.EnumResponse{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#EnumResponse.
	}
	resp, err := c.VerifyEnum(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type EchoCallOptions

type EchoCallOptions struct {
	Echo                    []gax.CallOption
	EchoErrorDetails        []gax.CallOption
	Expand                  []gax.CallOption
	Collect                 []gax.CallOption
	Chat                    []gax.CallOption
	PagedExpand             []gax.CallOption
	PagedExpandLegacy       []gax.CallOption
	PagedExpandLegacyMapped []gax.CallOption
	Wait                    []gax.CallOption
	Block                   []gax.CallOption
	ListLocations           []gax.CallOption
	GetLocation             []gax.CallOption
	SetIamPolicy            []gax.CallOption
	GetIamPolicy            []gax.CallOption
	TestIamPermissions      []gax.CallOption
	ListOperations          []gax.CallOption
	GetOperation            []gax.CallOption
	DeleteOperation         []gax.CallOption
	CancelOperation         []gax.CallOption
}

EchoCallOptions contains the retry settings for each method of EchoClient.

type EchoClient

type EchoClient struct {

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

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

EchoClient is a client for interacting with Client Libraries Showcase API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

This service is used showcase the four main types of rpcs - unary, server side streaming, client side streaming, and bidirectional streaming. This service also exposes methods that explicitly implement server delay, and paginated calls. Set the ‘showcase-trailer’ metadata key on any method to have the values echoed in the response trailers. Set the ‘x-goog-request-params’ metadata key on any method to have the values echoed in the response headers.

func NewEchoClient

func NewEchoClient(ctx context.Context, opts ...option.ClientOption) (*EchoClient, error)

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

This service is used showcase the four main types of rpcs - unary, server side streaming, client side streaming, and bidirectional streaming. This service also exposes methods that explicitly implement server delay, and paginated calls. Set the ‘showcase-trailer’ metadata key on any method to have the values echoed in the response trailers. Set the ‘x-goog-request-params’ metadata key on any method to have the values echoed in the response headers.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
)

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

	// TODO: Use client.
	_ = c
}
Output:

func NewEchoRESTClient added in v0.19.0

func NewEchoRESTClient(ctx context.Context, opts ...option.ClientOption) (*EchoClient, error)

NewEchoRESTClient creates a new echo rest client.

This service is used showcase the four main types of rpcs - unary, server side streaming, client side streaming, and bidirectional streaming. This service also exposes methods that explicitly implement server delay, and paginated calls. Set the ‘showcase-trailer’ metadata key on any method to have the values echoed in the response trailers. Set the ‘x-goog-request-params’ metadata key on any method to have the values echoed in the response headers.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
)

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

	// TODO: Use client.
	_ = c
}
Output:

func (*EchoClient) Block added in v0.3.0

Block this method will block (wait) for the requested amount of time and then return the response or error. This method showcases how a client handles delays or retries.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.BlockRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#BlockRequest.
	}
	resp, err := c.Block(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*EchoClient) CancelOperation added in v0.14.0

func (c *EchoClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error

CancelOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

	req := &longrunningpb.CancelOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
	}
	err = c.CancelOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*EchoClient) Chat

Chat this method, upon receiving a request on the stream, will pass the same content back on the stream. This method showcases bidirectional streaming RPCs.

This method is not supported for the REST transport.

Example
package main

import (
	"context"
	"io"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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 := client.NewEchoClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()
	stream, err := c.Chat(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	go func() {
		reqs := []*genprotopb.EchoRequest{
			// TODO: Create requests.
		}
		for _, req := range reqs {
			if err := stream.Send(req); err != nil {
				// TODO: Handle error.
			}
		}
		stream.CloseSend()
	}()
	for {
		resp, err := stream.Recv()
		if err == io.EOF {
			break
		}
		if err != nil {
			// TODO: handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*EchoClient) Close

func (c *EchoClient) Close() error

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

func (*EchoClient) Collect

Collect this method will collect the words given to it. When the stream is closed by the client, this method will return the a concatenation of the strings passed to it. This method showcases client-side streaming RPCs.

This method is not supported for the REST transport.

func (*EchoClient) Connection deprecated

func (c *EchoClient) 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 (*EchoClient) DeleteOperation added in v0.14.0

func (c *EchoClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error

DeleteOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

	req := &longrunningpb.DeleteOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
	}
	err = c.DeleteOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*EchoClient) Echo

Echo this method simply echoes the request. This method showcases unary RPCs.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.EchoRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#EchoRequest.
	}
	resp, err := c.Echo(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*EchoClient) EchoErrorDetails added in v0.29.0

EchoErrorDetails this method returns error details in a repeated “google.protobuf.Any” field. This method showcases handling errors thus encoded, particularly over REST transport. Note that GAPICs only allow the type “google.protobuf.Any” for field paths ending in “error.details”, and, at run-time, the actual types for these fields must be one of the types in google/rpc/error_details.proto.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.EchoErrorDetailsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#EchoErrorDetailsRequest.
	}
	resp, err := c.EchoErrorDetails(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*EchoClient) Expand

Expand this method splits the given content into words and will pass each word back through the stream. This method showcases server-side streaming RPCs.

func (*EchoClient) GetIamPolicy added in v0.14.0

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

GetIamPolicy is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewEchoClient(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
}
Output:

func (*EchoClient) GetLocation added in v0.14.0

GetLocation is a utility method from google.cloud.location.Locations.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	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 := client.NewEchoClient(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
}
Output:

func (*EchoClient) GetOperation added in v0.14.0

GetOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

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

func (*EchoClient) ListLocations added in v0.14.0

ListLocations is a utility method from google.cloud.location.Locations.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
	"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 := client.NewEchoClient(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)
	}
}
Output:

func (*EchoClient) ListOperations added in v0.14.0

ListOperations is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
	"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 := client.NewEchoClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

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

func (*EchoClient) PagedExpand

PagedExpand this is similar to the Expand method but instead of returning a stream of expanded words, this method returns a paged list of expanded words.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
	"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 := client.NewEchoClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &genprotopb.PagedExpandRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#PagedExpandRequest.
	}
	it := c.PagedExpand(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.(*genprotopb.PagedExpandResponse)
	}
}
Output:

func (*EchoClient) PagedExpandLegacy added in v0.17.0

PagedExpandLegacy this is similar to the PagedExpand except that it uses max_results instead of page_size, as some legacy APIs still do. New APIs should NOT use this pattern.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
	"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 := client.NewEchoClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &genprotopb.PagedExpandLegacyRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#PagedExpandLegacyRequest.
	}
	it := c.PagedExpandLegacy(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.(*genprotopb.PagedExpandResponse)
	}
}
Output:

func (*EchoClient) PagedExpandLegacyMapped added in v0.17.0

PagedExpandLegacyMapped this method returns a map containing lists of words that appear in the input, keyed by their initial character. The only words returned are the ones included in the current page, as determined by page_token and page_size, which both refer to the word indices in the input. This paging result consisting of a map of lists is a pattern used by some legacy APIs. New APIs should NOT use this pattern.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
	"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 := client.NewEchoClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &genprotopb.PagedExpandRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#PagedExpandRequest.
	}
	it := c.PagedExpandLegacyMapped(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.(*genprotopb.PagedExpandLegacyMappedResponse)
	}
}
Output:

func (*EchoClient) SetIamPolicy added in v0.14.0

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

SetIamPolicy is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewEchoClient(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
}
Output:

func (*EchoClient) TestIamPermissions added in v0.14.0

TestIamPermissions is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewEchoClient(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
}
Output:

func (*EchoClient) Wait

Wait this method will wait for the requested amount of time and then return. This method showcases how a client handles a request timeout.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.WaitRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#WaitRequest.
	}
	op, err := c.Wait(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*EchoClient) WaitOperation

func (c *EchoClient) WaitOperation(name string) *WaitOperation

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

type EchoResponseIterator

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

EchoResponseIterator manages a stream of *genprotopb.EchoResponse.

func (*EchoResponseIterator) Next

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*EchoResponseIterator) PageInfo

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

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

type IdentityCallOptions

type IdentityCallOptions struct {
	CreateUser         []gax.CallOption
	GetUser            []gax.CallOption
	UpdateUser         []gax.CallOption
	DeleteUser         []gax.CallOption
	ListUsers          []gax.CallOption
	ListLocations      []gax.CallOption
	GetLocation        []gax.CallOption
	SetIamPolicy       []gax.CallOption
	GetIamPolicy       []gax.CallOption
	TestIamPermissions []gax.CallOption
	ListOperations     []gax.CallOption
	GetOperation       []gax.CallOption
	DeleteOperation    []gax.CallOption
	CancelOperation    []gax.CallOption
}

IdentityCallOptions contains the retry settings for each method of IdentityClient.

type IdentityClient

type IdentityClient struct {

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

IdentityClient is a client for interacting with Client Libraries Showcase API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

A simple identity service.

func NewIdentityClient

func NewIdentityClient(ctx context.Context, opts ...option.ClientOption) (*IdentityClient, error)

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

A simple identity service.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
)

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

	// TODO: Use client.
	_ = c
}
Output:

func NewIdentityRESTClient added in v0.19.0

func NewIdentityRESTClient(ctx context.Context, opts ...option.ClientOption) (*IdentityClient, error)

NewIdentityRESTClient creates a new identity rest client.

A simple identity service.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
)

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

	// TODO: Use client.
	_ = c
}
Output:

func (*IdentityClient) CancelOperation added in v0.14.0

func (c *IdentityClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error

CancelOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

	req := &longrunningpb.CancelOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
	}
	err = c.CancelOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*IdentityClient) Close

func (c *IdentityClient) Close() error

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

func (*IdentityClient) Connection deprecated

func (c *IdentityClient) 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 (*IdentityClient) CreateUser

CreateUser creates a user.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.CreateUserRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#CreateUserRequest.
	}
	resp, err := c.CreateUser(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*IdentityClient) DeleteOperation added in v0.14.0

func (c *IdentityClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error

DeleteOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

	req := &longrunningpb.DeleteOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
	}
	err = c.DeleteOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*IdentityClient) DeleteUser

func (c *IdentityClient) DeleteUser(ctx context.Context, req *genprotopb.DeleteUserRequest, opts ...gax.CallOption) error

DeleteUser deletes a user, their profile, and all of their authored messages.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.DeleteUserRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#DeleteUserRequest.
	}
	err = c.DeleteUser(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*IdentityClient) GetIamPolicy added in v0.14.0

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

GetIamPolicy is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewIdentityClient(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
}
Output:

func (*IdentityClient) GetLocation added in v0.14.0

GetLocation is a utility method from google.cloud.location.Locations.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	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 := client.NewIdentityClient(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
}
Output:

func (*IdentityClient) GetOperation added in v0.14.0

GetOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

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

func (*IdentityClient) GetUser

GetUser retrieves the User with the given uri.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.GetUserRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#GetUserRequest.
	}
	resp, err := c.GetUser(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*IdentityClient) ListLocations added in v0.14.0

ListLocations is a utility method from google.cloud.location.Locations.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
	"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 := client.NewIdentityClient(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)
	}
}
Output:

func (*IdentityClient) ListOperations added in v0.14.0

ListOperations is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
	"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 := client.NewIdentityClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

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

func (*IdentityClient) ListUsers

ListUsers lists all users.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
	"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 := client.NewIdentityClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &genprotopb.ListUsersRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#ListUsersRequest.
	}
	it := c.ListUsers(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.(*genprotopb.ListUsersResponse)
	}
}
Output:

func (*IdentityClient) SetIamPolicy added in v0.14.0

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

SetIamPolicy is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewIdentityClient(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
}
Output:

func (*IdentityClient) TestIamPermissions added in v0.14.0

TestIamPermissions is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewIdentityClient(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
}
Output:

func (*IdentityClient) UpdateUser

UpdateUser updates a user.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.UpdateUserRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#UpdateUserRequest.
	}
	resp, err := c.UpdateUser(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type LocationIterator added in v0.14.0

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) Next added in v0.14.0

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 added in v0.14.0

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

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

type MessagingCallOptions

type MessagingCallOptions struct {
	CreateRoom         []gax.CallOption
	GetRoom            []gax.CallOption
	UpdateRoom         []gax.CallOption
	DeleteRoom         []gax.CallOption
	ListRooms          []gax.CallOption
	CreateBlurb        []gax.CallOption
	GetBlurb           []gax.CallOption
	UpdateBlurb        []gax.CallOption
	DeleteBlurb        []gax.CallOption
	ListBlurbs         []gax.CallOption
	SearchBlurbs       []gax.CallOption
	StreamBlurbs       []gax.CallOption
	SendBlurbs         []gax.CallOption
	Connect            []gax.CallOption
	ListLocations      []gax.CallOption
	GetLocation        []gax.CallOption
	SetIamPolicy       []gax.CallOption
	GetIamPolicy       []gax.CallOption
	TestIamPermissions []gax.CallOption
	ListOperations     []gax.CallOption
	GetOperation       []gax.CallOption
	DeleteOperation    []gax.CallOption
	CancelOperation    []gax.CallOption
}

MessagingCallOptions contains the retry settings for each method of MessagingClient.

type MessagingClient

type MessagingClient struct {

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

	// LROClient is used internally to handle long-running operations.
	// It is exposed so that its CallOptions can be modified if required.
	// Users should not Close this client.
	LROClient *lroauto.OperationsClient
	// contains filtered or unexported fields
}

MessagingClient is a client for interacting with Client Libraries Showcase API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

A simple messaging service that implements chat rooms and profile posts.

This messaging service showcases the features that API clients generated by gapic-generators implement.

func NewMessagingClient

func NewMessagingClient(ctx context.Context, opts ...option.ClientOption) (*MessagingClient, error)

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

A simple messaging service that implements chat rooms and profile posts.

This messaging service showcases the features that API clients generated by gapic-generators implement.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
)

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

	// TODO: Use client.
	_ = c
}
Output:

func NewMessagingRESTClient added in v0.19.0

func NewMessagingRESTClient(ctx context.Context, opts ...option.ClientOption) (*MessagingClient, error)

NewMessagingRESTClient creates a new messaging rest client.

A simple messaging service that implements chat rooms and profile posts.

This messaging service showcases the features that API clients generated by gapic-generators implement.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
)

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

	// TODO: Use client.
	_ = c
}
Output:

func (*MessagingClient) CancelOperation added in v0.14.0

func (c *MessagingClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error

CancelOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

	req := &longrunningpb.CancelOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
	}
	err = c.CancelOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*MessagingClient) Close

func (c *MessagingClient) Close() error

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

func (*MessagingClient) Connect

Connect this method starts a bidirectional stream that receives all blurbs that are being created after the stream has started and sends requests to create blurbs. If an invalid blurb is requested to be created, the stream will close with an error.

This method is not supported for the REST transport.

Example
package main

import (
	"context"
	"io"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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 := client.NewMessagingClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()
	stream, err := c.Connect(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	go func() {
		reqs := []*genprotopb.ConnectRequest{
			// TODO: Create requests.
		}
		for _, req := range reqs {
			if err := stream.Send(req); err != nil {
				// TODO: Handle error.
			}
		}
		stream.CloseSend()
	}()
	for {
		resp, err := stream.Recv()
		if err == io.EOF {
			break
		}
		if err != nil {
			// TODO: handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

func (*MessagingClient) Connection deprecated

func (c *MessagingClient) 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 (*MessagingClient) CreateBlurb

CreateBlurb creates a blurb. If the parent is a room, the blurb is understood to be a message in that room. If the parent is a profile, the blurb is understood to be a post on the profile.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.CreateBlurbRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#CreateBlurbRequest.
	}
	resp, err := c.CreateBlurb(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*MessagingClient) CreateRoom

CreateRoom creates a room.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.CreateRoomRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#CreateRoomRequest.
	}
	resp, err := c.CreateRoom(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*MessagingClient) DeleteBlurb

func (c *MessagingClient) DeleteBlurb(ctx context.Context, req *genprotopb.DeleteBlurbRequest, opts ...gax.CallOption) error

DeleteBlurb deletes a blurb.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.DeleteBlurbRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#DeleteBlurbRequest.
	}
	err = c.DeleteBlurb(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*MessagingClient) DeleteOperation added in v0.14.0

func (c *MessagingClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error

DeleteOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

	req := &longrunningpb.DeleteOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
	}
	err = c.DeleteOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*MessagingClient) DeleteRoom

func (c *MessagingClient) DeleteRoom(ctx context.Context, req *genprotopb.DeleteRoomRequest, opts ...gax.CallOption) error

DeleteRoom deletes a room and all of its blurbs.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.DeleteRoomRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#DeleteRoomRequest.
	}
	err = c.DeleteRoom(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*MessagingClient) GetBlurb

GetBlurb retrieves the Blurb with the given resource name.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.GetBlurbRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#GetBlurbRequest.
	}
	resp, err := c.GetBlurb(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*MessagingClient) GetIamPolicy added in v0.14.0

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

GetIamPolicy is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewMessagingClient(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
}
Output:

func (*MessagingClient) GetLocation added in v0.14.0

GetLocation is a utility method from google.cloud.location.Locations.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	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 := client.NewMessagingClient(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
}
Output:

func (*MessagingClient) GetOperation added in v0.14.0

GetOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

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

func (*MessagingClient) GetRoom

GetRoom retrieves the Room with the given resource name.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.GetRoomRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#GetRoomRequest.
	}
	resp, err := c.GetRoom(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*MessagingClient) ListBlurbs

ListBlurbs lists blurbs for a specific chat room or user profile depending on the parent resource name.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
	"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 := client.NewMessagingClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &genprotopb.ListBlurbsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#ListBlurbsRequest.
	}
	it := c.ListBlurbs(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.(*genprotopb.ListBlurbsResponse)
	}
}
Output:

func (*MessagingClient) ListLocations added in v0.14.0

ListLocations is a utility method from google.cloud.location.Locations.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
	"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 := client.NewMessagingClient(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)
	}
}
Output:

func (*MessagingClient) ListOperations added in v0.14.0

ListOperations is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
	"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 := client.NewMessagingClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

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

func (*MessagingClient) ListRooms

ListRooms lists all chat rooms.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
	"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 := client.NewMessagingClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &genprotopb.ListRoomsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#ListRoomsRequest.
	}
	it := c.ListRooms(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.(*genprotopb.ListRoomsResponse)
	}
}
Output:

func (*MessagingClient) SearchBlurbs

SearchBlurbs this method searches through all blurbs across all rooms and profiles for blurbs containing to words found in the query. Only posts that contain an exact match of a queried word will be returned.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.SearchBlurbsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#SearchBlurbsRequest.
	}
	op, err := c.SearchBlurbs(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}

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

func (*MessagingClient) SearchBlurbsOperation

func (c *MessagingClient) SearchBlurbsOperation(name string) *SearchBlurbsOperation

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

func (*MessagingClient) SendBlurbs

SendBlurbs this is a stream to create multiple blurbs. If an invalid blurb is requested to be created, the stream will close with an error.

This method is not supported for the REST transport.

func (*MessagingClient) SetIamPolicy added in v0.14.0

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

SetIamPolicy is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewMessagingClient(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
}
Output:

func (*MessagingClient) StreamBlurbs

StreamBlurbs this returns a stream that emits the blurbs that are created for a particular chat room or user profile.

func (*MessagingClient) TestIamPermissions added in v0.14.0

TestIamPermissions is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewMessagingClient(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
}
Output:

func (*MessagingClient) UpdateBlurb

UpdateBlurb updates a blurb.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.UpdateBlurbRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#UpdateBlurbRequest.
	}
	resp, err := c.UpdateBlurb(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*MessagingClient) UpdateRoom

UpdateRoom updates a room.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.UpdateRoomRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#UpdateRoomRequest.
	}
	resp, err := c.UpdateRoom(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type OperationIterator added in v0.14.0

type OperationIterator struct {

	// Response is the raw response for the current page.
	// It must be cast to the RPC response type.
	// Calling Next() or InternalFetch() updates this value.
	Response interface{}

	// InternalFetch is for use by the Google Cloud Libraries only.
	// It is not part of the stable interface of this package.
	//
	// InternalFetch returns results from a single call to the underlying RPC.
	// The number of results is no greater than pageSize.
	// If there are no more results, nextPageToken is empty and err is nil.
	InternalFetch func(pageSize int, pageToken string) (results []*longrunningpb.Operation, nextPageToken string, err error)
	// contains filtered or unexported fields
}

OperationIterator manages a stream of *longrunningpb.Operation.

func (*OperationIterator) Next added in v0.14.0

Next returns the next result. Its second return value is iterator.Done if there are no more results. Once Next returns Done, all subsequent calls will return Done.

func (*OperationIterator) PageInfo added in v0.14.0

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

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

type PagedExpandResponseListPair added in v0.17.0

type PagedExpandResponseListPair struct {
	Key   string
	Value *genprotopb.PagedExpandResponseList
}

PagedExpandResponseListPair is a holder type for string/*genprotopb.PagedExpandResponseList map entries

type PagedExpandResponseListPairIterator added in v0.17.0

type PagedExpandResponseListPairIterator 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 []PagedExpandResponseListPair, nextPageToken string, err error)
	// contains filtered or unexported fields
}

PagedExpandResponseListPairIterator manages a stream of PagedExpandResponseListPair.

func (*PagedExpandResponseListPairIterator) Next added in v0.17.0

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 (*PagedExpandResponseListPairIterator) PageInfo added in v0.17.0

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

type RoomIterator

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

RoomIterator manages a stream of *genprotopb.Room.

func (*RoomIterator) Next

func (it *RoomIterator) Next() (*genprotopb.Room, 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 (*RoomIterator) PageInfo

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

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

type SearchBlurbsOperation

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

SearchBlurbsOperation manages a long-running operation from SearchBlurbs.

func (*SearchBlurbsOperation) Done

func (op *SearchBlurbsOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*SearchBlurbsOperation) Metadata

Metadata returns metadata associated with the long-running operation. Metadata itself does not contact the server, but Poll does. To get the latest metadata, call this method after a successful call to Poll. If the metadata is not available, the returned metadata and error are both nil.

func (*SearchBlurbsOperation) Name

func (op *SearchBlurbsOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*SearchBlurbsOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*SearchBlurbsOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

type SequenceCallOptions added in v0.12.0

type SequenceCallOptions struct {
	CreateSequence             []gax.CallOption
	CreateStreamingSequence    []gax.CallOption
	GetSequenceReport          []gax.CallOption
	GetStreamingSequenceReport []gax.CallOption
	AttemptSequence            []gax.CallOption
	AttemptStreamingSequence   []gax.CallOption
	ListLocations              []gax.CallOption
	GetLocation                []gax.CallOption
	SetIamPolicy               []gax.CallOption
	GetIamPolicy               []gax.CallOption
	TestIamPermissions         []gax.CallOption
	ListOperations             []gax.CallOption
	GetOperation               []gax.CallOption
	DeleteOperation            []gax.CallOption
	CancelOperation            []gax.CallOption
}

SequenceCallOptions contains the retry settings for each method of SequenceClient.

type SequenceClient added in v0.12.0

type SequenceClient struct {

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

SequenceClient is a client for interacting with Client Libraries Showcase API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

func NewSequenceClient added in v0.12.0

func NewSequenceClient(ctx context.Context, opts ...option.ClientOption) (*SequenceClient, error)

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

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
)

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

	// TODO: Use client.
	_ = c
}
Output:

func NewSequenceRESTClient added in v0.19.0

func NewSequenceRESTClient(ctx context.Context, opts ...option.ClientOption) (*SequenceClient, error)

NewSequenceRESTClient creates a new sequence service rest client.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
)

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

	// TODO: Use client.
	_ = c
}
Output:

func (*SequenceClient) AttemptSequence added in v0.12.0

func (c *SequenceClient) AttemptSequence(ctx context.Context, req *genprotopb.AttemptSequenceRequest, opts ...gax.CallOption) error

AttemptSequence attempts a sequence.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.AttemptSequenceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#AttemptSequenceRequest.
	}
	err = c.AttemptSequence(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*SequenceClient) AttemptStreamingSequence added in v0.27.0

AttemptStreamingSequence attempts a streaming sequence.

func (*SequenceClient) CancelOperation added in v0.14.0

func (c *SequenceClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error

CancelOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

	req := &longrunningpb.CancelOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
	}
	err = c.CancelOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*SequenceClient) Close added in v0.12.0

func (c *SequenceClient) Close() error

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

func (*SequenceClient) Connection deprecated added in v0.12.0

func (c *SequenceClient) 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 (*SequenceClient) CreateSequence added in v0.12.0

CreateSequence creates a sequence.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.CreateSequenceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#CreateSequenceRequest.
	}
	resp, err := c.CreateSequence(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*SequenceClient) CreateStreamingSequence added in v0.27.0

CreateStreamingSequence creates a sequence.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.CreateStreamingSequenceRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#CreateStreamingSequenceRequest.
	}
	resp, err := c.CreateStreamingSequence(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*SequenceClient) DeleteOperation added in v0.14.0

func (c *SequenceClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error

DeleteOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

	req := &longrunningpb.DeleteOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
	}
	err = c.DeleteOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*SequenceClient) GetIamPolicy added in v0.14.0

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

GetIamPolicy is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewSequenceClient(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
}
Output:

func (*SequenceClient) GetLocation added in v0.14.0

GetLocation is a utility method from google.cloud.location.Locations.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	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 := client.NewSequenceClient(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
}
Output:

func (*SequenceClient) GetOperation added in v0.14.0

GetOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

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

func (*SequenceClient) GetSequenceReport added in v0.12.0

GetSequenceReport retrieves a sequence.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.GetSequenceReportRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#GetSequenceReportRequest.
	}
	resp, err := c.GetSequenceReport(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*SequenceClient) GetStreamingSequenceReport added in v0.27.0

GetStreamingSequenceReport retrieves a sequence.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.GetStreamingSequenceReportRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#GetStreamingSequenceReportRequest.
	}
	resp, err := c.GetStreamingSequenceReport(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*SequenceClient) ListLocations added in v0.14.0

ListLocations is a utility method from google.cloud.location.Locations.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
	"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 := client.NewSequenceClient(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)
	}
}
Output:

func (*SequenceClient) ListOperations added in v0.14.0

ListOperations is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
	"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 := client.NewSequenceClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

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

func (*SequenceClient) SetIamPolicy added in v0.14.0

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

SetIamPolicy is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewSequenceClient(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
}
Output:

func (*SequenceClient) TestIamPermissions added in v0.14.0

TestIamPermissions is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewSequenceClient(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
}
Output:

type SessionIterator

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

SessionIterator manages a stream of *genprotopb.Session.

func (*SessionIterator) Next

func (it *SessionIterator) Next() (*genprotopb.Session, 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 (*SessionIterator) PageInfo

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

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

type TestIterator

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

TestIterator manages a stream of *genprotopb.Test.

func (*TestIterator) Next

func (it *TestIterator) Next() (*genprotopb.Test, 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 (*TestIterator) PageInfo

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

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

type TestingCallOptions

type TestingCallOptions struct {
	CreateSession      []gax.CallOption
	GetSession         []gax.CallOption
	ListSessions       []gax.CallOption
	DeleteSession      []gax.CallOption
	ReportSession      []gax.CallOption
	ListTests          []gax.CallOption
	DeleteTest         []gax.CallOption
	VerifyTest         []gax.CallOption
	ListLocations      []gax.CallOption
	GetLocation        []gax.CallOption
	SetIamPolicy       []gax.CallOption
	GetIamPolicy       []gax.CallOption
	TestIamPermissions []gax.CallOption
	ListOperations     []gax.CallOption
	GetOperation       []gax.CallOption
	DeleteOperation    []gax.CallOption
	CancelOperation    []gax.CallOption
}

TestingCallOptions contains the retry settings for each method of TestingClient.

type TestingClient

type TestingClient struct {

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

TestingClient is a client for interacting with Client Libraries Showcase API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.

A service to facilitate running discrete sets of tests against Showcase. Adding this comment with special characters for comment formatting tests:

(abra->kadabra->alakazam)

Nonsense: pokemon/*/psychic/*

func NewTestingClient

func NewTestingClient(ctx context.Context, opts ...option.ClientOption) (*TestingClient, error)

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

A service to facilitate running discrete sets of tests against Showcase. Adding this comment with special characters for comment formatting tests:

(abra->kadabra->alakazam)

Nonsense: pokemon/*/psychic/*

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
)

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

	// TODO: Use client.
	_ = c
}
Output:

func NewTestingRESTClient added in v0.19.0

func NewTestingRESTClient(ctx context.Context, opts ...option.ClientOption) (*TestingClient, error)

NewTestingRESTClient creates a new testing rest client.

A service to facilitate running discrete sets of tests against Showcase. Adding this comment with special characters for comment formatting tests:

(abra->kadabra->alakazam)

Nonsense: pokemon/*/psychic/*

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
)

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

	// TODO: Use client.
	_ = c
}
Output:

func (*TestingClient) CancelOperation added in v0.14.0

func (c *TestingClient) CancelOperation(ctx context.Context, req *longrunningpb.CancelOperationRequest, opts ...gax.CallOption) error

CancelOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

	req := &longrunningpb.CancelOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#CancelOperationRequest.
	}
	err = c.CancelOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*TestingClient) Close

func (c *TestingClient) Close() error

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

func (*TestingClient) Connection deprecated

func (c *TestingClient) 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 (*TestingClient) CreateSession

CreateSession creates a new testing session. Adding this comment with special characters for comment formatting tests:

(abra->kadabra->alakazam)

Nonsense: pokemon/*/psychic/*

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.CreateSessionRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#CreateSessionRequest.
	}
	resp, err := c.CreateSession(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*TestingClient) DeleteOperation added in v0.14.0

func (c *TestingClient) DeleteOperation(ctx context.Context, req *longrunningpb.DeleteOperationRequest, opts ...gax.CallOption) error

DeleteOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

	req := &longrunningpb.DeleteOperationRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/cloud.google.com/go/longrunning/autogen/longrunningpb#DeleteOperationRequest.
	}
	err = c.DeleteOperation(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*TestingClient) DeleteSession

func (c *TestingClient) DeleteSession(ctx context.Context, req *genprotopb.DeleteSessionRequest, opts ...gax.CallOption) error

DeleteSession delete a test session.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.DeleteSessionRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#DeleteSessionRequest.
	}
	err = c.DeleteSession(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*TestingClient) DeleteTest

func (c *TestingClient) DeleteTest(ctx context.Context, req *genprotopb.DeleteTestRequest, opts ...gax.CallOption) error

DeleteTest explicitly decline to implement a test.

This removes the test from subsequent ListTests calls, and attempting to do the test will error.

This method will error if attempting to delete a required test.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.DeleteTestRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#DeleteTestRequest.
	}
	err = c.DeleteTest(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*TestingClient) GetIamPolicy added in v0.14.0

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

GetIamPolicy is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewTestingClient(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
}
Output:

func (*TestingClient) GetLocation added in v0.14.0

GetLocation is a utility method from google.cloud.location.Locations.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	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 := client.NewTestingClient(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
}
Output:

func (*TestingClient) GetOperation added in v0.14.0

GetOperation is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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

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

func (*TestingClient) GetSession

GetSession gets a testing session.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.GetSessionRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#GetSessionRequest.
	}
	resp, err := c.GetSession(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*TestingClient) ListLocations added in v0.14.0

ListLocations is a utility method from google.cloud.location.Locations.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"
	"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 := client.NewTestingClient(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)
	}
}
Output:

func (*TestingClient) ListOperations added in v0.14.0

ListOperations is a utility method from google.longrunning.Operations.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
	"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 := client.NewTestingClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

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

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

func (*TestingClient) ListSessions

ListSessions lists the current test sessions.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
	"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 := client.NewTestingClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &genprotopb.ListSessionsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#ListSessionsRequest.
	}
	it := c.ListSessions(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.(*genprotopb.ListSessionsResponse)
	}
}
Output:

func (*TestingClient) ListTests

ListTests list the tests of a sessesion.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
	"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 := client.NewTestingClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &genprotopb.ListTestsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#ListTestsRequest.
	}
	it := c.ListTests(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.(*genprotopb.ListTestsResponse)
	}
}
Output:

func (*TestingClient) ReportSession

ReportSession report on the status of a session. This generates a report detailing which tests have been completed, and an overall rollup.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.ReportSessionRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#ReportSessionRequest.
	}
	resp, err := c.ReportSession(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*TestingClient) SetIamPolicy added in v0.14.0

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

SetIamPolicy is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewTestingClient(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
}
Output:

func (*TestingClient) TestIamPermissions added in v0.14.0

TestIamPermissions is a utility method from google.iam.v1.IAMPolicy.

Example
package main

import (
	"context"

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

	client "github.com/googleapis/gapic-showcase/client"
)

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 := client.NewTestingClient(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
}
Output:

func (*TestingClient) VerifyTest

VerifyTest register a response to a test.

In cases where a test involves registering a final answer at the end of the test, this method provides the means to do so.

Example
package main

import (
	"context"

	client "github.com/googleapis/gapic-showcase/client"

	genprotopb "github.com/googleapis/gapic-showcase/server/genproto"
)

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

	req := &genprotopb.VerifyTestRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/googleapis/gapic-showcase/server/genproto#VerifyTestRequest.
	}
	resp, err := c.VerifyTest(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type UserIterator

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

UserIterator manages a stream of *genprotopb.User.

func (*UserIterator) Next

func (it *UserIterator) Next() (*genprotopb.User, 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 (*UserIterator) PageInfo

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

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

type WaitOperation

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

WaitOperation manages a long-running operation from Wait.

func (*WaitOperation) Done

func (op *WaitOperation) Done() bool

Done reports whether the long-running operation has completed.

func (*WaitOperation) Metadata

func (op *WaitOperation) Metadata() (*genprotopb.WaitMetadata, error)

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

func (op *WaitOperation) Name() string

Name returns the name of the long-running operation. The name is assigned by the server and is unique within the service from which the operation is created.

func (*WaitOperation) Poll

Poll fetches the latest state of the long-running operation.

Poll also fetches the latest metadata, which can be retrieved by Metadata.

If Poll fails, the error is returned and op is unmodified. If Poll succeeds and the operation has completed with failure, the error is returned and op.Done will return true. If Poll succeeds and the operation has completed successfully, op.Done will return true, and the response of the operation is returned. If Poll succeeds and the operation has not completed, the returned response and error are both nil.

func (*WaitOperation) Wait

Wait blocks until the long-running operation is completed, returning the response and any errors encountered.

See documentation of Poll for error-handling information.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL