Documentation ¶
Overview ¶
NOTE: This package is in beta. It is not stable, and may be subject to changes.
Use of Context ¶
The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
For information about setting deadlines, reusing contexts, and more please visit godoc.org/cloud.google.com/go.
Index ¶
- func DefaultAuthScopes() []string
- type CloudFunctionIterator
- type CloudFunctionsCallOptions
- type CloudFunctionsClient
- func (c *CloudFunctionsClient) CallFunction(ctx context.Context, req *functionspb.CallFunctionRequest, ...) (*functionspb.CallFunctionResponse, error)
- func (c *CloudFunctionsClient) Close() error
- func (c *CloudFunctionsClient) Connection() *grpc.ClientConn
- func (c *CloudFunctionsClient) CreateFunction(ctx context.Context, req *functionspb.CreateFunctionRequest, ...) (*CreateFunctionOperation, error)
- func (c *CloudFunctionsClient) CreateFunctionOperation(name string) *CreateFunctionOperation
- func (c *CloudFunctionsClient) DeleteFunction(ctx context.Context, req *functionspb.DeleteFunctionRequest, ...) (*DeleteFunctionOperation, error)
- func (c *CloudFunctionsClient) DeleteFunctionOperation(name string) *DeleteFunctionOperation
- func (c *CloudFunctionsClient) GenerateDownloadUrl(ctx context.Context, req *functionspb.GenerateDownloadUrlRequest, ...) (*functionspb.GenerateDownloadUrlResponse, error)
- func (c *CloudFunctionsClient) GenerateUploadUrl(ctx context.Context, req *functionspb.GenerateUploadUrlRequest, ...) (*functionspb.GenerateUploadUrlResponse, error)
- func (c *CloudFunctionsClient) GetFunction(ctx context.Context, req *functionspb.GetFunctionRequest, ...) (*functionspb.CloudFunction, error)
- func (c *CloudFunctionsClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *CloudFunctionsClient) ListFunctions(ctx context.Context, req *functionspb.ListFunctionsRequest, ...) *CloudFunctionIterator
- func (c *CloudFunctionsClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
- func (c *CloudFunctionsClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, ...) (*iampb.TestIamPermissionsResponse, error)
- func (c *CloudFunctionsClient) UpdateFunction(ctx context.Context, req *functionspb.UpdateFunctionRequest, ...) (*UpdateFunctionOperation, error)
- func (c *CloudFunctionsClient) UpdateFunctionOperation(name string) *UpdateFunctionOperation
- type CreateFunctionOperation
- func (op *CreateFunctionOperation) Done() bool
- func (op *CreateFunctionOperation) Metadata() (*functionspb.OperationMetadataV1, error)
- func (op *CreateFunctionOperation) Name() string
- func (op *CreateFunctionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*functionspb.CloudFunction, error)
- func (op *CreateFunctionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*functionspb.CloudFunction, error)
- type DeleteFunctionOperation
- func (op *DeleteFunctionOperation) Done() bool
- func (op *DeleteFunctionOperation) Metadata() (*functionspb.OperationMetadataV1, error)
- func (op *DeleteFunctionOperation) Name() string
- func (op *DeleteFunctionOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
- func (op *DeleteFunctionOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
- type UpdateFunctionOperation
- func (op *UpdateFunctionOperation) Done() bool
- func (op *UpdateFunctionOperation) Metadata() (*functionspb.OperationMetadataV1, error)
- func (op *UpdateFunctionOperation) Name() string
- func (op *UpdateFunctionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*functionspb.CloudFunction, error)
- func (op *UpdateFunctionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*functionspb.CloudFunction, error)
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 CloudFunctionIterator ¶
type CloudFunctionIterator 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 []*functionspb.CloudFunction, nextPageToken string, err error) // contains filtered or unexported fields }
CloudFunctionIterator manages a stream of *functionspb.CloudFunction.
func (*CloudFunctionIterator) Next ¶
func (it *CloudFunctionIterator) Next() (*functionspb.CloudFunction, 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 (*CloudFunctionIterator) PageInfo ¶
func (it *CloudFunctionIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
type CloudFunctionsCallOptions ¶
type CloudFunctionsCallOptions struct { ListFunctions []gax.CallOption GetFunction []gax.CallOption CreateFunction []gax.CallOption UpdateFunction []gax.CallOption DeleteFunction []gax.CallOption CallFunction []gax.CallOption GenerateUploadUrl []gax.CallOption GenerateDownloadUrl []gax.CallOption SetIamPolicy []gax.CallOption GetIamPolicy []gax.CallOption TestIamPermissions []gax.CallOption }
CloudFunctionsCallOptions contains the retry settings for each method of CloudFunctionsClient.
type CloudFunctionsClient ¶
type CloudFunctionsClient struct { // LROClient is used internally to handle longrunning operations. // It is exposed so that its CallOptions can be modified if required. // Users should not Close this client. LROClient *lroauto.OperationsClient // The call options for this service. CallOptions *CloudFunctionsCallOptions // contains filtered or unexported fields }
CloudFunctionsClient is a client for interacting with .
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewCloudFunctionsClient ¶
func NewCloudFunctionsClient(ctx context.Context, opts ...option.ClientOption) (*CloudFunctionsClient, error)
NewCloudFunctionsClient creates a new cloud functions service client.
A service that application uses to manipulate triggers and functions.
func (*CloudFunctionsClient) CallFunction ¶
func (c *CloudFunctionsClient) CallFunction(ctx context.Context, req *functionspb.CallFunctionRequest, opts ...gax.CallOption) (*functionspb.CallFunctionResponse, error)
CallFunction synchronously invokes a deployed Cloud Function. To be used for testing purposes as very limited traffic is allowed. For more information on the actual limits, refer to Rate Limits (at https://cloud.google.com/functions/quotas#rate_limits).
func (*CloudFunctionsClient) Close ¶
func (c *CloudFunctionsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*CloudFunctionsClient) Connection ¶
func (c *CloudFunctionsClient) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated.
func (*CloudFunctionsClient) CreateFunction ¶
func (c *CloudFunctionsClient) CreateFunction(ctx context.Context, req *functionspb.CreateFunctionRequest, opts ...gax.CallOption) (*CreateFunctionOperation, error)
CreateFunction creates a new function. If a function with the given name already exists in the specified project, the long running operation will return ALREADY_EXISTS error.
func (*CloudFunctionsClient) CreateFunctionOperation ¶
func (c *CloudFunctionsClient) CreateFunctionOperation(name string) *CreateFunctionOperation
CreateFunctionOperation returns a new CreateFunctionOperation from a given name. The name must be that of a previously created CreateFunctionOperation, possibly from a different process.
func (*CloudFunctionsClient) DeleteFunction ¶
func (c *CloudFunctionsClient) DeleteFunction(ctx context.Context, req *functionspb.DeleteFunctionRequest, opts ...gax.CallOption) (*DeleteFunctionOperation, error)
DeleteFunction deletes a function with the given name from the specified project. If the given function is used by some trigger, the trigger will be updated to remove this function.
func (*CloudFunctionsClient) DeleteFunctionOperation ¶
func (c *CloudFunctionsClient) DeleteFunctionOperation(name string) *DeleteFunctionOperation
DeleteFunctionOperation returns a new DeleteFunctionOperation from a given name. The name must be that of a previously created DeleteFunctionOperation, possibly from a different process.
func (*CloudFunctionsClient) GenerateDownloadUrl ¶
func (c *CloudFunctionsClient) GenerateDownloadUrl(ctx context.Context, req *functionspb.GenerateDownloadUrlRequest, opts ...gax.CallOption) (*functionspb.GenerateDownloadUrlResponse, error)
GenerateDownloadUrl returns a signed URL for downloading deployed function source code. The URL is only valid for a limited period and should be used within minutes after generation. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls (at https://cloud.google.com/storage/docs/access-control/signed-urls)
func (*CloudFunctionsClient) GenerateUploadUrl ¶
func (c *CloudFunctionsClient) GenerateUploadUrl(ctx context.Context, req *functionspb.GenerateUploadUrlRequest, opts ...gax.CallOption) (*functionspb.GenerateUploadUrlResponse, error)
GenerateUploadUrl returns a signed URL for uploading a function source code. For more information about the signed URL usage see: https://cloud.google.com/storage/docs/access-control/signed-urls (at https://cloud.google.com/storage/docs/access-control/signed-urls). Once the function source code upload is complete, the used signed URL should be provided in CreateFunction or UpdateFunction request as a reference to the function source code.
When uploading source code to the generated signed URL, please follow these restrictions:
Source file type should be a zip file. Source file size should not exceed 100MB limit. No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL.
When making a HTTP PUT request, these two headers need to be specified:
content-type: application/zip x-goog-content-length-range: 0,104857600
And this header SHOULD NOT be specified:
Authorization: Bearer YOUR_TOKEN
func (*CloudFunctionsClient) GetFunction ¶
func (c *CloudFunctionsClient) GetFunction(ctx context.Context, req *functionspb.GetFunctionRequest, opts ...gax.CallOption) (*functionspb.CloudFunction, error)
GetFunction returns a function with the given name from the requested project.
func (*CloudFunctionsClient) GetIamPolicy ¶
func (c *CloudFunctionsClient) GetIamPolicy(ctx context.Context, req *iampb.GetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
GetIamPolicy gets the IAM access control policy for a function. Returns an empty policy if the function exists and does not have a policy set.
func (*CloudFunctionsClient) ListFunctions ¶
func (c *CloudFunctionsClient) ListFunctions(ctx context.Context, req *functionspb.ListFunctionsRequest, opts ...gax.CallOption) *CloudFunctionIterator
ListFunctions returns a list of functions that belong to the requested project.
func (*CloudFunctionsClient) SetIamPolicy ¶
func (c *CloudFunctionsClient) SetIamPolicy(ctx context.Context, req *iampb.SetIamPolicyRequest, opts ...gax.CallOption) (*iampb.Policy, error)
SetIamPolicy sets the IAM access control policy on the specified function. Replaces any existing policy.
func (*CloudFunctionsClient) TestIamPermissions ¶
func (c *CloudFunctionsClient) TestIamPermissions(ctx context.Context, req *iampb.TestIamPermissionsRequest, opts ...gax.CallOption) (*iampb.TestIamPermissionsResponse, error)
TestIamPermissions tests the specified permissions against the IAM access control policy for a function. If the function does not exist, this will return an empty set of permissions, not a NOT_FOUND error.
func (*CloudFunctionsClient) UpdateFunction ¶
func (c *CloudFunctionsClient) UpdateFunction(ctx context.Context, req *functionspb.UpdateFunctionRequest, opts ...gax.CallOption) (*UpdateFunctionOperation, error)
UpdateFunction updates existing function.
func (*CloudFunctionsClient) UpdateFunctionOperation ¶
func (c *CloudFunctionsClient) UpdateFunctionOperation(name string) *UpdateFunctionOperation
UpdateFunctionOperation returns a new UpdateFunctionOperation from a given name. The name must be that of a previously created UpdateFunctionOperation, possibly from a different process.
type CreateFunctionOperation ¶
type CreateFunctionOperation struct {
// contains filtered or unexported fields
}
CreateFunctionOperation manages a long-running operation from CreateFunction.
func (*CreateFunctionOperation) Done ¶
func (op *CreateFunctionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*CreateFunctionOperation) Metadata ¶
func (op *CreateFunctionOperation) Metadata() (*functionspb.OperationMetadataV1, 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 (*CreateFunctionOperation) Name ¶
func (op *CreateFunctionOperation) 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 (*CreateFunctionOperation) Poll ¶
func (op *CreateFunctionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*functionspb.CloudFunction, error)
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 (*CreateFunctionOperation) Wait ¶
func (op *CreateFunctionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*functionspb.CloudFunction, error)
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 DeleteFunctionOperation ¶
type DeleteFunctionOperation struct {
// contains filtered or unexported fields
}
DeleteFunctionOperation manages a long-running operation from DeleteFunction.
func (*DeleteFunctionOperation) Done ¶
func (op *DeleteFunctionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*DeleteFunctionOperation) Metadata ¶
func (op *DeleteFunctionOperation) Metadata() (*functionspb.OperationMetadataV1, 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 (*DeleteFunctionOperation) Name ¶
func (op *DeleteFunctionOperation) 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 (*DeleteFunctionOperation) Poll ¶
func (op *DeleteFunctionOperation) Poll(ctx context.Context, opts ...gax.CallOption) error
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 (*DeleteFunctionOperation) Wait ¶
func (op *DeleteFunctionOperation) Wait(ctx context.Context, opts ...gax.CallOption) error
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 UpdateFunctionOperation ¶
type UpdateFunctionOperation struct {
// contains filtered or unexported fields
}
UpdateFunctionOperation manages a long-running operation from UpdateFunction.
func (*UpdateFunctionOperation) Done ¶
func (op *UpdateFunctionOperation) Done() bool
Done reports whether the long-running operation has completed.
func (*UpdateFunctionOperation) Metadata ¶
func (op *UpdateFunctionOperation) Metadata() (*functionspb.OperationMetadataV1, 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 (*UpdateFunctionOperation) Name ¶
func (op *UpdateFunctionOperation) 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 (*UpdateFunctionOperation) Poll ¶
func (op *UpdateFunctionOperation) Poll(ctx context.Context, opts ...gax.CallOption) (*functionspb.CloudFunction, error)
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 (*UpdateFunctionOperation) Wait ¶
func (op *UpdateFunctionOperation) Wait(ctx context.Context, opts ...gax.CallOption) (*functionspb.CloudFunction, error)
Wait blocks until the long-running operation is completed, returning the response and any errors encountered.
See documentation of Poll for error-handling information.