- 0.116.0 (latest)
- 0.115.1
- 0.114.0
- 0.113.0
- 0.112.2
- 0.111.0
- 0.110.10
- 0.109.0
- 0.108.0
- 0.107.0
- 0.106.0
- 0.105.0
- 0.104.0
- 0.103.0
- 0.102.1
- 0.101.1
- 0.100.2
- 0.99.0
- 0.98.0
- 0.97.0
- 0.96.0
- 0.95.0
- 0.94.1
- 0.93.3
- 0.92.3
- 0.91.1
- 0.90.0
- 0.89.0
- 0.88.0
- 0.87.0
- 0.86.0
- 0.85.0
- 0.84.0
- 0.83.0
- 0.82.0
- 0.81.0
- 0.80.0
- 0.79.0
- 0.78.0
- 0.77.0
- 0.76.0
- 0.75.0
Use of Context
The ctx passed to NewClient is used for authentication requests and for creating the underlying connection, but is not used for subsequent calls. Individual methods on the client use the ctx given to them.
To close the open connection, use the Close() method.
For information about setting deadlines, reusing contexts, and more please visit pkg.go.dev/cloud.google.com/go.
Functions
func DefaultAuthScopes
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
ApprovalRequestIterator
type ApprovalRequestIterator 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 []*accessapprovalpb.ApprovalRequest, nextPageToken string, err error)
// contains filtered or unexported fields
}
ApprovalRequestIterator manages a stream of *accessapprovalpb.ApprovalRequest.
func (*ApprovalRequestIterator) Next
func (it *ApprovalRequestIterator) Next() (*accessapprovalpb.ApprovalRequest, 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 (*ApprovalRequestIterator) PageInfo
func (it *ApprovalRequestIterator) PageInfo() *iterator.PageInfo
PageInfo supports pagination. See the google.golang.org/api/iterator package for details.
CallOptions
type CallOptions struct {
ListApprovalRequests []gax.CallOption
GetApprovalRequest []gax.CallOption
ApproveApprovalRequest []gax.CallOption
DismissApprovalRequest []gax.CallOption
GetAccessApprovalSettings []gax.CallOption
UpdateAccessApprovalSettings []gax.CallOption
DeleteAccessApprovalSettings []gax.CallOption
}
CallOptions contains the retry settings for each method of Client.
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.
func NewClient
NewClient creates a new access approval client.
This API allows a customer to manage accesses to cloud resources by Google personnel. It defines the following resource model:
The API has a collection of ApprovalRequest resources, named approvalRequests/{approval_request_id}
The API has top-level settings per Project/Folder/Organization, named accessApprovalSettings
The service also periodically emails a list of recipients, defined at the Project/Folder/Organization level in the accessApprovalSettings, when there is a pending ApprovalRequest for them to act on. The ApprovalRequests can also optionally be published to a Cloud Pub/Sub topic owned by the customer (for Beta, the Pub/Sub setup is managed manually).
ApprovalRequests can be approved or dismissed. Google personel can only access the indicated resource or resources if the request is approved (subject to some exclusions: https://cloud.google.com/access-approval/docs/overview#exclusions (at https://cloud.google.com/access-approval/docs/overview#exclusions)).
Note: Using Access Approval functionality will mean that Google may not be able to meet the SLAs for your chosen products, as any support response times may be dramatically increased. As such the SLAs do not apply to any service disruption to the extent impacted by Customer’s use of Access Approval. Do not enable Access Approval for projects where you may require high service availability and rapid response by Google Cloud Support.
After a request is approved or dismissed, no further action may be taken on it. Requests with the requested_expiration in the past or with no activity for 14 days are considered dismissed. When an approval expires, the request is considered dismissed.
If a request is not approved or dismissed, we call it pending.
Example
package main
import (
"context"
accessapproval "cloud.google.com/go/accessapproval/apiv1"
)
func main() {
ctx := context.Background()
c, err := accessapproval.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
// TODO: Use client.
_ = c
}
func (*Client) ApproveApprovalRequest
func (c *Client) ApproveApprovalRequest(ctx context.Context, req *accessapprovalpb.ApproveApprovalRequestMessage, opts ...gax.CallOption) (*accessapprovalpb.ApprovalRequest, error)
ApproveApprovalRequest approves a request and returns the updated ApprovalRequest.
Returns NOT_FOUND if the request does not exist. Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
Example
package main
import (
"context"
accessapproval "cloud.google.com/go/accessapproval/apiv1"
accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
)
func main() {
// import accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
ctx := context.Background()
c, err := accessapproval.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &accessapprovalpb.ApproveApprovalRequestMessage{
// TODO: Fill request struct fields.
}
resp, err := c.ApproveApprovalRequest(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) Close
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*Client) Connection
func (c *Client) Connection() *grpc.ClientConn
Connection returns a connection to the API service.
Deprecated.
func (*Client) DeleteAccessApprovalSettings
func (c *Client) DeleteAccessApprovalSettings(ctx context.Context, req *accessapprovalpb.DeleteAccessApprovalSettingsMessage, opts ...gax.CallOption) error
DeleteAccessApprovalSettings deletes the settings associated with a project, folder, or organization. This will have the effect of disabling Access Approval for the project, folder, or organization, but only if all ancestors also have Access Approval disabled. If Access Approval is enabled at a higher level of the hierarchy, then Access Approval will still be enabled at this level as the settings are inherited.
Example
package main
import (
"context"
accessapproval "cloud.google.com/go/accessapproval/apiv1"
accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
)
func main() {
ctx := context.Background()
c, err := accessapproval.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &accessapprovalpb.DeleteAccessApprovalSettingsMessage{
// TODO: Fill request struct fields.
}
err = c.DeleteAccessApprovalSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
}
func (*Client) DismissApprovalRequest
func (c *Client) DismissApprovalRequest(ctx context.Context, req *accessapprovalpb.DismissApprovalRequestMessage, opts ...gax.CallOption) (*accessapprovalpb.ApprovalRequest, error)
DismissApprovalRequest dismisses a request. Returns the updated ApprovalRequest.
NOTE: This does not deny access to the resource if another request has been made and approved. It is equivalent in effect to ignoring the request altogether.
Returns NOT_FOUND if the request does not exist.
Returns FAILED_PRECONDITION if the request exists but is not in a pending state.
Example
package main
import (
"context"
accessapproval "cloud.google.com/go/accessapproval/apiv1"
accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
)
func main() {
// import accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
ctx := context.Background()
c, err := accessapproval.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &accessapprovalpb.DismissApprovalRequestMessage{
// TODO: Fill request struct fields.
}
resp, err := c.DismissApprovalRequest(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetAccessApprovalSettings
func (c *Client) GetAccessApprovalSettings(ctx context.Context, req *accessapprovalpb.GetAccessApprovalSettingsMessage, opts ...gax.CallOption) (*accessapprovalpb.AccessApprovalSettings, error)
GetAccessApprovalSettings gets the settings associated with a project, folder, or organization.
Example
package main
import (
"context"
accessapproval "cloud.google.com/go/accessapproval/apiv1"
accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
)
func main() {
// import accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
ctx := context.Background()
c, err := accessapproval.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &accessapprovalpb.GetAccessApprovalSettingsMessage{
// TODO: Fill request struct fields.
}
resp, err := c.GetAccessApprovalSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) GetApprovalRequest
func (c *Client) GetApprovalRequest(ctx context.Context, req *accessapprovalpb.GetApprovalRequestMessage, opts ...gax.CallOption) (*accessapprovalpb.ApprovalRequest, error)
GetApprovalRequest gets an approval request. Returns NOT_FOUND if the request does not exist.
Example
package main
import (
"context"
accessapproval "cloud.google.com/go/accessapproval/apiv1"
accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
)
func main() {
// import accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
ctx := context.Background()
c, err := accessapproval.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &accessapprovalpb.GetApprovalRequestMessage{
// TODO: Fill request struct fields.
}
resp, err := c.GetApprovalRequest(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
func (*Client) ListApprovalRequests
func (c *Client) ListApprovalRequests(ctx context.Context, req *accessapprovalpb.ListApprovalRequestsMessage, opts ...gax.CallOption) *ApprovalRequestIterator
ListApprovalRequests lists approval requests associated with a project, folder, or organization. Approval requests can be filtered by state (pending, active, dismissed). The order is reverse chronological.
Example
package main
import (
"context"
accessapproval "cloud.google.com/go/accessapproval/apiv1"
"google.golang.org/api/iterator"
accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
)
func main() {
// import accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
// import "google.golang.org/api/iterator"
ctx := context.Background()
c, err := accessapproval.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &accessapprovalpb.ListApprovalRequestsMessage{
// TODO: Fill request struct fields.
}
it := c.ListApprovalRequests(ctx, req)
for {
resp, err := it.Next()
if err == iterator.Done {
break
}
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
}
func (*Client) UpdateAccessApprovalSettings
func (c *Client) UpdateAccessApprovalSettings(ctx context.Context, req *accessapprovalpb.UpdateAccessApprovalSettingsMessage, opts ...gax.CallOption) (*accessapprovalpb.AccessApprovalSettings, error)
UpdateAccessApprovalSettings updates the settings associated with a project, folder, or organization. Settings to update are determined by the value of field_mask.
Example
package main
import (
"context"
accessapproval "cloud.google.com/go/accessapproval/apiv1"
accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
)
func main() {
// import accessapprovalpb "google.golang.org/genproto/googleapis/cloud/accessapproval/v1"
ctx := context.Background()
c, err := accessapproval.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
req := &accessapprovalpb.UpdateAccessApprovalSettingsMessage{
// TODO: Fill request struct fields.
}
resp, err := c.UpdateAccessApprovalSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}