package accessapproval
import "cloud.google.com/go/accessapproval/apiv1"
Package accessapproval is an auto-generated package for the Access Approval API.
An API for controlling access to data by Google personnel.
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 https://pkg.go.dev/cloud.google.com/go.
Index ¶
- func DefaultAuthScopes() []string
- type ApprovalRequestIterator
- func (it *ApprovalRequestIterator) Next() (*accessapprovalpb.ApprovalRequest, error)
- func (it *ApprovalRequestIterator) PageInfo() *iterator.PageInfo
- type CallOptions
- type Client
- func NewClient(ctx context.Context, opts ...option.ClientOption) (*Client, error)
- func (c *Client) ApproveApprovalRequest(ctx context.Context, req *accessapprovalpb.ApproveApprovalRequestMessage, opts ...gax.CallOption) (*accessapprovalpb.ApprovalRequest, error)
- func (c *Client) Close() error
- func (c *Client) Connection() *grpc.ClientConn
- func (c *Client) DeleteAccessApprovalSettings(ctx context.Context, req *accessapprovalpb.DeleteAccessApprovalSettingsMessage, opts ...gax.CallOption) error
- func (c *Client) DismissApprovalRequest(ctx context.Context, req *accessapprovalpb.DismissApprovalRequestMessage, opts ...gax.CallOption) (*accessapprovalpb.ApprovalRequest, error)
- func (c *Client) GetAccessApprovalSettings(ctx context.Context, req *accessapprovalpb.GetAccessApprovalSettingsMessage, opts ...gax.CallOption) (*accessapprovalpb.AccessApprovalSettings, error)
- func (c *Client) GetApprovalRequest(ctx context.Context, req *accessapprovalpb.GetApprovalRequestMessage, opts ...gax.CallOption) (*accessapprovalpb.ApprovalRequest, error)
- func (c *Client) ListApprovalRequests(ctx context.Context, req *accessapprovalpb.ListApprovalRequestsMessage, opts ...gax.CallOption) *ApprovalRequestIterator
- func (c *Client) UpdateAccessApprovalSettings(ctx context.Context, req *accessapprovalpb.UpdateAccessApprovalSettingsMessage, opts ...gax.CallOption) (*accessapprovalpb.AccessApprovalSettings, error)
Examples ¶
- Client.ApproveApprovalRequest
- Client.DeleteAccessApprovalSettings
- Client.DismissApprovalRequest
- Client.GetAccessApprovalSettings
- Client.GetApprovalRequest
- Client.ListApprovalRequests
- Client.UpdateAccessApprovalSettings
- NewClient
Functions ¶
func DefaultAuthScopes ¶
func DefaultAuthScopes() []string
DefaultAuthScopes reports the default set of authentication scopes to use with this package.
Types ¶
type 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.
type 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.
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 Access Approval API. Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
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.
func NewClient ¶
NewClient creates a new access approval client based on gRPC. The returned client must be Closed when it is done being used to clean up its underlying connections.
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.
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.
Code:play
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.
}
defer c.Close()
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.
Code:play
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.
}
defer c.Close()
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.
Code:play
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.
}
defer c.Close()
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.
Code:play
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.
}
defer c.Close()
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.
Code:play
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.
}
defer c.Close()
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.
Code:play
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() {
ctx := context.Background()
c, err := accessapproval.NewClient(ctx)
if err != nil {
// TODO: Handle error.
}
defer c.Close()
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.
Code:play
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.
}
defer c.Close()
req := &accessapprovalpb.UpdateAccessApprovalSettingsMessage{
// TODO: Fill request struct fields.
}
resp, err := c.UpdateAccessApprovalSettings(ctx, req)
if err != nil {
// TODO: Handle error.
}
// TODO: Use resp.
_ = resp
}
Source Files ¶
access_approval_client.go doc.go
- Version
- v0.90.0
- Published
- Aug 3, 2021
- Platform
- js/wasm
- Imports
- 20 packages
- Last checked
- 8 minutes ago –
Tools for package owners.