Documentation ¶
Overview ¶
Package credentials is an auto-generated package for the IAM Service Account Credentials API.
NOTE: This package is in alpha. It is not stable, and is likely to change.
IAM Service Account Credentials API
Index ¶
- func DefaultAuthScopes() []string
- type IamCredentialsCallOptions
- type IamCredentialsClient
- func (c *IamCredentialsClient) Close() error
- func (c *IamCredentialsClient) Connection() *grpc.ClientConn
- func (c *IamCredentialsClient) GenerateAccessToken(ctx context.Context, req *credentialspb.GenerateAccessTokenRequest, ...) (*credentialspb.GenerateAccessTokenResponse, error)
- func (c *IamCredentialsClient) GenerateIdToken(ctx context.Context, req *credentialspb.GenerateIdTokenRequest, ...) (*credentialspb.GenerateIdTokenResponse, error)
- func (c *IamCredentialsClient) GenerateIdentityBindingAccessToken(ctx context.Context, ...) (*credentialspb.GenerateIdentityBindingAccessTokenResponse, error)
- func (c *IamCredentialsClient) SignBlob(ctx context.Context, req *credentialspb.SignBlobRequest, ...) (*credentialspb.SignBlobResponse, error)
- func (c *IamCredentialsClient) SignJwt(ctx context.Context, req *credentialspb.SignJwtRequest, opts ...gax.CallOption) (*credentialspb.SignJwtResponse, error)
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 IamCredentialsCallOptions ¶
type IamCredentialsCallOptions struct { GenerateAccessToken []gax.CallOption GenerateIdToken []gax.CallOption SignBlob []gax.CallOption SignJwt []gax.CallOption GenerateIdentityBindingAccessToken []gax.CallOption }
IamCredentialsCallOptions contains the retry settings for each method of IamCredentialsClient.
type IamCredentialsClient ¶
type IamCredentialsClient struct { // The call options for this service. CallOptions *IamCredentialsCallOptions // contains filtered or unexported fields }
IamCredentialsClient is a client for interacting with IAM Service Account Credentials API.
Methods, except Close, may be called concurrently. However, fields must not be modified concurrently with method calls.
func NewIamCredentialsClient ¶
func NewIamCredentialsClient(ctx context.Context, opts ...option.ClientOption) (*IamCredentialsClient, error)
NewIamCredentialsClient creates a new iam credentials client.
A service account is a special type of Google account that belongs to your application or a virtual machine (VM), instead of to an individual end user. Your application assumes the identity of the service account to call Google APIs, so that the users aren't directly involved.
Service account credentials are used to temporarily assume the identity of the service account. Supported credential types include OAuth 2.0 access tokens, OpenID Connect ID tokens, self-signed JSON Web Tokens (JWTs), and more.
Example ¶
ctx := context.Background() c, err := credentials.NewIamCredentialsClient(ctx) if err != nil { // TODO: Handle error. } // TODO: Use client. _ = c
Output:
func (*IamCredentialsClient) Close ¶
func (c *IamCredentialsClient) Close() error
Close closes the connection to the API service. The user should invoke this when the client is no longer required.
func (*IamCredentialsClient) Connection ¶
func (c *IamCredentialsClient) Connection() *grpc.ClientConn
Connection returns the client's connection to the API service.
func (*IamCredentialsClient) GenerateAccessToken ¶
func (c *IamCredentialsClient) GenerateAccessToken(ctx context.Context, req *credentialspb.GenerateAccessTokenRequest, opts ...gax.CallOption) (*credentialspb.GenerateAccessTokenResponse, error)
GenerateAccessToken generates an OAuth 2.0 access token for a service account.
Example ¶
ctx := context.Background() c, err := credentials.NewIamCredentialsClient(ctx) if err != nil { // TODO: Handle error. } req := &credentialspb.GenerateAccessTokenRequest{ // TODO: Fill request struct fields. } resp, err := c.GenerateAccessToken(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*IamCredentialsClient) GenerateIdToken ¶
func (c *IamCredentialsClient) GenerateIdToken(ctx context.Context, req *credentialspb.GenerateIdTokenRequest, opts ...gax.CallOption) (*credentialspb.GenerateIdTokenResponse, error)
GenerateIdToken generates an OpenID Connect ID token for a service account.
Example ¶
ctx := context.Background() c, err := credentials.NewIamCredentialsClient(ctx) if err != nil { // TODO: Handle error. } req := &credentialspb.GenerateIdTokenRequest{ // TODO: Fill request struct fields. } resp, err := c.GenerateIdToken(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*IamCredentialsClient) GenerateIdentityBindingAccessToken ¶
func (c *IamCredentialsClient) GenerateIdentityBindingAccessToken(ctx context.Context, req *credentialspb.GenerateIdentityBindingAccessTokenRequest, opts ...gax.CallOption) (*credentialspb.GenerateIdentityBindingAccessTokenResponse, error)
GenerateIdentityBindingAccessToken exchange a JWT signed by third party identity provider to an OAuth 2.0 access token
Example ¶
ctx := context.Background() c, err := credentials.NewIamCredentialsClient(ctx) if err != nil { // TODO: Handle error. } req := &credentialspb.GenerateIdentityBindingAccessTokenRequest{ // TODO: Fill request struct fields. } resp, err := c.GenerateIdentityBindingAccessToken(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*IamCredentialsClient) SignBlob ¶
func (c *IamCredentialsClient) SignBlob(ctx context.Context, req *credentialspb.SignBlobRequest, opts ...gax.CallOption) (*credentialspb.SignBlobResponse, error)
SignBlob signs a blob using a service account's system-managed private key.
Example ¶
ctx := context.Background() c, err := credentials.NewIamCredentialsClient(ctx) if err != nil { // TODO: Handle error. } req := &credentialspb.SignBlobRequest{ // TODO: Fill request struct fields. } resp, err := c.SignBlob(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output:
func (*IamCredentialsClient) SignJwt ¶
func (c *IamCredentialsClient) SignJwt(ctx context.Context, req *credentialspb.SignJwtRequest, opts ...gax.CallOption) (*credentialspb.SignJwtResponse, error)
SignJwt signs a JWT using a service account's system-managed private key.
Example ¶
ctx := context.Background() c, err := credentials.NewIamCredentialsClient(ctx) if err != nil { // TODO: Handle error. } req := &credentialspb.SignJwtRequest{ // TODO: Fill request struct fields. } resp, err := c.SignJwt(ctx, req) if err != nil { // TODO: Handle error. } // TODO: Use resp. _ = resp
Output: