project

package
v0.0.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2023 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Overview

NOTE: This package is in alpha. It is not stable, and is likely to change.

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

req := &projectpb.BlockRequest{
	// TODO: Fill request struct fields.
	// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#BlockRequest.
}
resp, err := c.Block(ctx, req)
if err != nil {
	// TODO: Handle error.
}
// TODO: Use resp.
_ = resp

Use of Context

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

type CallOptions struct {
	CreateProject []gax.CallOption
	GetProject    []gax.CallOption
	ListProjects  []gax.CallOption
	DeleteProject []gax.CallOption
}

CallOptions contains the retry settings for each method of Client.

type Client

type Client struct {

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

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

[Projects] API.

Manages Projects. Projects contain sets of other entities

func NewClient

func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)

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

[Projects] API.

Manages Projects. Projects contain sets of other entities

Example
package main

import (
	"context"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
)

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

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

func NewRESTClient

func NewRESTClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)

NewRESTClient creates a new project service rest client.

[Projects] API.

Manages Projects. Projects contain sets of other entities

Example
package main

import (
	"context"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
)

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

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

func (*Client) Close

func (c *Client) Close() error

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

func (*Client) Connection deprecated

func (c *Client) 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 (*Client) CreateProject

func (c *Client) CreateProject(ctx context.Context, req *projectpb.CreateProjectRequest, opts ...gax.CallOption) (*projectpb.Project, error)

CreateProject creates a new project.

Example
package main

import (
	"context"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
)

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

	req := &projectpb.CreateProjectRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#CreateProjectRequest.
	}
	resp, err := c.CreateProject(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) DeleteProject

func (c *Client) DeleteProject(ctx context.Context, req *projectpb.DeleteProjectRequest, opts ...gax.CallOption) error

DeleteProject deletes the specified project.

Example
package main

import (
	"context"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
)

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

	req := &projectpb.DeleteProjectRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#DeleteProjectRequest.
	}
	err = c.DeleteProject(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*Client) GetProject

func (c *Client) GetProject(ctx context.Context, req *projectpb.GetProjectRequest, opts ...gax.CallOption) (*projectpb.Project, error)

GetProject gets the specified project.

Example
package main

import (
	"context"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
)

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

	req := &projectpb.GetProjectRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#GetProjectRequest.
	}
	resp, err := c.GetProject(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*Client) ListProjects

func (c *Client) ListProjects(ctx context.Context, req *projectpb.ListProjectsRequest, opts ...gax.CallOption) *ProjectIterator

ListProjects lists projects.

Example
package main

import (
	"context"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
	"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 := project.NewClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &projectpb.ListProjectsRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#ListProjectsRequest.
	}
	it := c.ListProjects(ctx, req)
	for {
		resp, err := it.Next()
		if err == iterator.Done {
			break
		}
		if err != nil {
			// TODO: Handle error.
		}
		// TODO: Use resp.
		_ = resp
	}
}
Output:

type EchoCallOptions

type EchoCallOptions struct {
	Echo        []gax.CallOption
	Expand      []gax.CallOption
	Collect     []gax.CallOption
	Chat        []gax.CallOption
	PagedExpand []gax.CallOption
	Wait        []gax.CallOption
	Block       []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 . 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 service 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"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
)

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

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

func NewEchoRESTClient

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

NewEchoRESTClient creates a new echo service 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"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
)

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

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

func (*EchoClient) Block

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"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
)

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

	req := &projectpb.BlockRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#BlockRequest.
	}
	resp, err := c.Block(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
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"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
)

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 := project.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 := []*projectpb.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) Echo

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

Example
package main

import (
	"context"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
)

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

	req := &projectpb.EchoRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#EchoRequest.
	}
	resp, err := c.Echo(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) 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"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
	"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 := project.NewEchoClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &projectpb.PagedExpandRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#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
	}
}
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"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
)

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

	req := &projectpb.WaitRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#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 []*projectpb.EchoResponse, nextPageToken string, err error)
	// contains filtered or unexported fields
}

EchoResponseIterator manages a stream of *projectpb.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
	ListUsers  []gax.CallOption
	UpdateUser []gax.CallOption
	DeleteUser []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 . 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 service 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"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
)

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

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

func NewIdentityRESTClient

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

NewIdentityRESTClient creates a new identity service rest client.

A simple identity service.

Example
package main

import (
	"context"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
)

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

	// TODO: Use client.
	_ = c
}
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"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
)

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

	req := &projectpb.CreateUserRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#CreateUserRequest.
	}
	resp, err := c.CreateUser(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*IdentityClient) DeleteUser

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

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

Example
package main

import (
	"context"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
)

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

	req := &projectpb.DeleteUserRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#DeleteUserRequest.
	}
	err = c.DeleteUser(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
}
Output:

func (*IdentityClient) GetUser

GetUser retrieves the User with the given uri.

Example
package main

import (
	"context"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
)

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

	req := &projectpb.GetUserRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#GetUserRequest.
	}
	resp, err := c.GetUser(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

func (*IdentityClient) ListUsers

ListUsers lists all users.

Example
package main

import (
	"context"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
	"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 := project.NewIdentityClient(ctx)
	if err != nil {
		// TODO: Handle error.
	}
	defer c.Close()

	req := &projectpb.ListUsersRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#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
	}
}
Output:

func (*IdentityClient) UpdateUser

UpdateUser updates a user.

Example
package main

import (
	"context"

	project "github.com/qclaogui/gaip/genproto/project/apiv1"
	projectpb "github.com/qclaogui/gaip/genproto/project/apiv1/projectpb"
)

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

	req := &projectpb.UpdateUserRequest{
		// TODO: Fill request struct fields.
		// See https://pkg.go.dev/github.com/qclaogui/gaip/genproto/project/apiv1/projectpb#UpdateUserRequest.
	}
	resp, err := c.UpdateUser(ctx, req)
	if err != nil {
		// TODO: Handle error.
	}
	// TODO: Use resp.
	_ = resp
}
Output:

type ProjectIterator

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

ProjectIterator manages a stream of *projectpb.Project.

func (*ProjectIterator) Next

func (it *ProjectIterator) Next() (*projectpb.Project, 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 (*ProjectIterator) PageInfo

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

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

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

UserIterator manages a stream of *projectpb.User.

func (*UserIterator) Next

func (it *UserIterator) Next() (*projectpb.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() (*projectpb.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