Documentation ¶
Overview ¶
Package apikeys provides access to the API Keys API.
For product documentation, see: https://cloud.google.com/api-keys/docs
Library status ¶
These client libraries are officially supported by Google. However, this library is considered complete and is in maintenance mode. This means that we will address critical bugs and security issues but will not add any new features.
When possible, we recommend using our newer [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go) that are still actively being worked and iterated on.
Creating a client ¶
Usage example:
import "google.golang.org/api/apikeys/v2" ... ctx := context.Background() apikeysService, err := apikeys.NewService(ctx)
In this example, Google Application Default Credentials are used for authentication. For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
Other authentication options ¶
By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use google.golang.org/api/option.WithScopes:
apikeysService, err := apikeys.NewService(ctx, option.WithScopes(apikeys.CloudPlatformReadOnlyScope))
To use an API key for authentication (note: some APIs do not support API keys), use google.golang.org/api/option.WithAPIKey:
apikeysService, err := apikeys.NewService(ctx, option.WithAPIKey("AIza..."))
To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow, use google.golang.org/api/option.WithTokenSource:
config := &oauth2.Config{...} // ... token, err := config.Exchange(ctx, ...) apikeysService, err := apikeys.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
See google.golang.org/api/option.ClientOption for details on options.
Index ¶
- Constants
- type KeysLookupKeyCall
- func (c *KeysLookupKeyCall) Context(ctx context.Context) *KeysLookupKeyCall
- func (c *KeysLookupKeyCall) Do(opts ...googleapi.CallOption) (*V2LookupKeyResponse, error)
- func (c *KeysLookupKeyCall) Fields(s ...googleapi.Field) *KeysLookupKeyCall
- func (c *KeysLookupKeyCall) Header() http.Header
- func (c *KeysLookupKeyCall) IfNoneMatch(entityTag string) *KeysLookupKeyCall
- func (c *KeysLookupKeyCall) KeyString(keyString string) *KeysLookupKeyCall
- type KeysService
- type Operation
- type OperationsGetCall
- func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall
- func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall
- func (c *OperationsGetCall) Header() http.Header
- func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall
- type OperationsService
- type ProjectsLocationsKeysCreateCall
- func (c *ProjectsLocationsKeysCreateCall) Context(ctx context.Context) *ProjectsLocationsKeysCreateCall
- func (c *ProjectsLocationsKeysCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *ProjectsLocationsKeysCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysCreateCall
- func (c *ProjectsLocationsKeysCreateCall) Header() http.Header
- func (c *ProjectsLocationsKeysCreateCall) KeyId(keyId string) *ProjectsLocationsKeysCreateCall
- type ProjectsLocationsKeysDeleteCall
- func (c *ProjectsLocationsKeysDeleteCall) Context(ctx context.Context) *ProjectsLocationsKeysDeleteCall
- func (c *ProjectsLocationsKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *ProjectsLocationsKeysDeleteCall) Etag(etag string) *ProjectsLocationsKeysDeleteCall
- func (c *ProjectsLocationsKeysDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysDeleteCall
- func (c *ProjectsLocationsKeysDeleteCall) Header() http.Header
- type ProjectsLocationsKeysGetCall
- func (c *ProjectsLocationsKeysGetCall) Context(ctx context.Context) *ProjectsLocationsKeysGetCall
- func (c *ProjectsLocationsKeysGetCall) Do(opts ...googleapi.CallOption) (*V2Key, error)
- func (c *ProjectsLocationsKeysGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysGetCall
- func (c *ProjectsLocationsKeysGetCall) Header() http.Header
- func (c *ProjectsLocationsKeysGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeysGetCall
- type ProjectsLocationsKeysGetKeyStringCall
- func (c *ProjectsLocationsKeysGetKeyStringCall) Context(ctx context.Context) *ProjectsLocationsKeysGetKeyStringCall
- func (c *ProjectsLocationsKeysGetKeyStringCall) Do(opts ...googleapi.CallOption) (*V2GetKeyStringResponse, error)
- func (c *ProjectsLocationsKeysGetKeyStringCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysGetKeyStringCall
- func (c *ProjectsLocationsKeysGetKeyStringCall) Header() http.Header
- func (c *ProjectsLocationsKeysGetKeyStringCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeysGetKeyStringCall
- type ProjectsLocationsKeysListCall
- func (c *ProjectsLocationsKeysListCall) Context(ctx context.Context) *ProjectsLocationsKeysListCall
- func (c *ProjectsLocationsKeysListCall) Do(opts ...googleapi.CallOption) (*V2ListKeysResponse, error)
- func (c *ProjectsLocationsKeysListCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysListCall
- func (c *ProjectsLocationsKeysListCall) Header() http.Header
- func (c *ProjectsLocationsKeysListCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeysListCall
- func (c *ProjectsLocationsKeysListCall) PageSize(pageSize int64) *ProjectsLocationsKeysListCall
- func (c *ProjectsLocationsKeysListCall) PageToken(pageToken string) *ProjectsLocationsKeysListCall
- func (c *ProjectsLocationsKeysListCall) Pages(ctx context.Context, f func(*V2ListKeysResponse) error) error
- func (c *ProjectsLocationsKeysListCall) ShowDeleted(showDeleted bool) *ProjectsLocationsKeysListCall
- type ProjectsLocationsKeysPatchCall
- func (c *ProjectsLocationsKeysPatchCall) Context(ctx context.Context) *ProjectsLocationsKeysPatchCall
- func (c *ProjectsLocationsKeysPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *ProjectsLocationsKeysPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysPatchCall
- func (c *ProjectsLocationsKeysPatchCall) Header() http.Header
- func (c *ProjectsLocationsKeysPatchCall) UpdateMask(updateMask string) *ProjectsLocationsKeysPatchCall
- type ProjectsLocationsKeysService
- func (r *ProjectsLocationsKeysService) Create(parent string, v2key *V2Key) *ProjectsLocationsKeysCreateCall
- func (r *ProjectsLocationsKeysService) Delete(name string) *ProjectsLocationsKeysDeleteCall
- func (r *ProjectsLocationsKeysService) Get(name string) *ProjectsLocationsKeysGetCall
- func (r *ProjectsLocationsKeysService) GetKeyString(name string) *ProjectsLocationsKeysGetKeyStringCall
- func (r *ProjectsLocationsKeysService) List(parent string) *ProjectsLocationsKeysListCall
- func (r *ProjectsLocationsKeysService) Patch(name string, v2key *V2Key) *ProjectsLocationsKeysPatchCall
- func (r *ProjectsLocationsKeysService) Undelete(name string, v2undeletekeyrequest *V2UndeleteKeyRequest) *ProjectsLocationsKeysUndeleteCall
- type ProjectsLocationsKeysUndeleteCall
- func (c *ProjectsLocationsKeysUndeleteCall) Context(ctx context.Context) *ProjectsLocationsKeysUndeleteCall
- func (c *ProjectsLocationsKeysUndeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error)
- func (c *ProjectsLocationsKeysUndeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysUndeleteCall
- func (c *ProjectsLocationsKeysUndeleteCall) Header() http.Header
- type ProjectsLocationsService
- type ProjectsService
- type Service
- type Status
- type V2AndroidApplication
- type V2AndroidKeyRestrictions
- type V2ApiTarget
- type V2BrowserKeyRestrictions
- type V2GetKeyStringResponse
- type V2IosKeyRestrictions
- type V2Key
- type V2ListKeysResponse
- type V2LookupKeyResponse
- type V2Restrictions
- type V2ServerKeyRestrictions
- type V2UndeleteKeyRequest
Constants ¶
const ( // See, edit, configure, and delete your Google Cloud data and see the email // address for your Google Account. CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platform" // View your data across Google Cloud services and see the email address of // your Google Account CloudPlatformReadOnlyScope = "https://www.googleapis.com/auth/cloud-platform.read-only" )
OAuth2 scopes used by this API.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeysLookupKeyCall ¶
type KeysLookupKeyCall struct {
// contains filtered or unexported fields
}
func (*KeysLookupKeyCall) Context ¶
func (c *KeysLookupKeyCall) Context(ctx context.Context) *KeysLookupKeyCall
Context sets the context to be used in this call's Do method.
func (*KeysLookupKeyCall) Do ¶
func (c *KeysLookupKeyCall) Do(opts ...googleapi.CallOption) (*V2LookupKeyResponse, error)
Do executes the "apikeys.keys.lookupKey" call. Any non-2xx status code is an error. Response headers are in either *V2LookupKeyResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*KeysLookupKeyCall) Fields ¶
func (c *KeysLookupKeyCall) Fields(s ...googleapi.Field) *KeysLookupKeyCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*KeysLookupKeyCall) Header ¶
func (c *KeysLookupKeyCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*KeysLookupKeyCall) IfNoneMatch ¶
func (c *KeysLookupKeyCall) IfNoneMatch(entityTag string) *KeysLookupKeyCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
func (*KeysLookupKeyCall) KeyString ¶
func (c *KeysLookupKeyCall) KeyString(keyString string) *KeysLookupKeyCall
KeyString sets the optional parameter "keyString": Required. Finds the project that owns the key string value.
type KeysService ¶
type KeysService struct {
// contains filtered or unexported fields
}
func NewKeysService ¶
func NewKeysService(s *Service) *KeysService
func (*KeysService) LookupKey ¶
func (r *KeysService) LookupKey() *KeysLookupKeyCall
LookupKey: Find the parent project and resource name of the API key that matches the key string in the request. If the API key has been purged, resource name will not be set. The service account must have the `apikeys.keys.lookup` permission on the parent project.
type Operation ¶
type Operation struct { // Done: If the value is `false`, it means the operation is still in progress. // If `true`, the operation is completed, and either `error` or `response` is // available. Done bool `json:"done,omitempty"` // Error: The error result of the operation in case of failure or cancellation. Error *Status `json:"error,omitempty"` // Metadata: Service-specific metadata associated with the operation. It // typically contains progress information and common metadata such as create // time. Some services might not provide such metadata. Any method that returns // a long-running operation should document the metadata type, if any. Metadata googleapi.RawMessage `json:"metadata,omitempty"` // Name: The server-assigned name, which is only unique within the same service // that originally returns it. If you use the default HTTP mapping, the `name` // should be a resource name ending with `operations/{unique_id}`. Name string `json:"name,omitempty"` // Response: The normal, successful response of the operation. If the original // method returns no data on success, such as `Delete`, the response is // `google.protobuf.Empty`. If the original method is standard // `Get`/`Create`/`Update`, the response should be the resource. For other // methods, the response should have the type `XxxResponse`, where `Xxx` is the // original method name. For example, if the original method name is // `TakeSnapshot()`, the inferred response type is `TakeSnapshotResponse`. Response googleapi.RawMessage `json:"response,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Done") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Done") to include in API requests // with the JSON null value. By default, fields with empty values are omitted // from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
Operation: This resource represents a long-running operation that is the result of a network API call.
func (*Operation) MarshalJSON ¶
type OperationsGetCall ¶
type OperationsGetCall struct {
// contains filtered or unexported fields
}
func (*OperationsGetCall) Context ¶
func (c *OperationsGetCall) Context(ctx context.Context) *OperationsGetCall
Context sets the context to be used in this call's Do method.
func (*OperationsGetCall) Do ¶
func (c *OperationsGetCall) Do(opts ...googleapi.CallOption) (*Operation, error)
Do executes the "apikeys.operations.get" call. Any non-2xx status code is an error. Response headers are in either *Operation.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*OperationsGetCall) Fields ¶
func (c *OperationsGetCall) Fields(s ...googleapi.Field) *OperationsGetCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*OperationsGetCall) Header ¶
func (c *OperationsGetCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*OperationsGetCall) IfNoneMatch ¶
func (c *OperationsGetCall) IfNoneMatch(entityTag string) *OperationsGetCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
type OperationsService ¶
type OperationsService struct {
// contains filtered or unexported fields
}
func NewOperationsService ¶
func NewOperationsService(s *Service) *OperationsService
func (*OperationsService) Get ¶
func (r *OperationsService) Get(name string) *OperationsGetCall
Get: Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service.
- name: The name of the operation resource.
type ProjectsLocationsKeysCreateCall ¶
type ProjectsLocationsKeysCreateCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsKeysCreateCall) Context ¶
func (c *ProjectsLocationsKeysCreateCall) Context(ctx context.Context) *ProjectsLocationsKeysCreateCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsKeysCreateCall) Do ¶
func (c *ProjectsLocationsKeysCreateCall) Do(opts ...googleapi.CallOption) (*Operation, error)
Do executes the "apikeys.projects.locations.keys.create" call. Any non-2xx status code is an error. Response headers are in either *Operation.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsKeysCreateCall) Fields ¶
func (c *ProjectsLocationsKeysCreateCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysCreateCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsKeysCreateCall) Header ¶
func (c *ProjectsLocationsKeysCreateCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsLocationsKeysCreateCall) KeyId ¶
func (c *ProjectsLocationsKeysCreateCall) KeyId(keyId string) *ProjectsLocationsKeysCreateCall
KeyId sets the optional parameter "keyId": User specified key id (optional). If specified, it will become the final component of the key resource name. The id must be unique within the project, must conform with RFC-1034, is restricted to lower-cased letters, and has a maximum length of 63 characters. In another word, the id must match the regular expression: `[a-z]([a-z0-9-]{0,61}[a-z0-9])?`. The id must NOT be a UUID-like string.
type ProjectsLocationsKeysDeleteCall ¶
type ProjectsLocationsKeysDeleteCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsKeysDeleteCall) Context ¶
func (c *ProjectsLocationsKeysDeleteCall) Context(ctx context.Context) *ProjectsLocationsKeysDeleteCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsKeysDeleteCall) Do ¶
func (c *ProjectsLocationsKeysDeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error)
Do executes the "apikeys.projects.locations.keys.delete" call. Any non-2xx status code is an error. Response headers are in either *Operation.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsKeysDeleteCall) Etag ¶
func (c *ProjectsLocationsKeysDeleteCall) Etag(etag string) *ProjectsLocationsKeysDeleteCall
Etag sets the optional parameter "etag": The etag known to the client for the expected state of the key. This is to be used for optimistic concurrency.
func (*ProjectsLocationsKeysDeleteCall) Fields ¶
func (c *ProjectsLocationsKeysDeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysDeleteCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsKeysDeleteCall) Header ¶
func (c *ProjectsLocationsKeysDeleteCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsLocationsKeysGetCall ¶
type ProjectsLocationsKeysGetCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsKeysGetCall) Context ¶
func (c *ProjectsLocationsKeysGetCall) Context(ctx context.Context) *ProjectsLocationsKeysGetCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsKeysGetCall) Do ¶
func (c *ProjectsLocationsKeysGetCall) Do(opts ...googleapi.CallOption) (*V2Key, error)
Do executes the "apikeys.projects.locations.keys.get" call. Any non-2xx status code is an error. Response headers are in either *V2Key.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsKeysGetCall) Fields ¶
func (c *ProjectsLocationsKeysGetCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysGetCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsKeysGetCall) Header ¶
func (c *ProjectsLocationsKeysGetCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsLocationsKeysGetCall) IfNoneMatch ¶
func (c *ProjectsLocationsKeysGetCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeysGetCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
type ProjectsLocationsKeysGetKeyStringCall ¶
type ProjectsLocationsKeysGetKeyStringCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsKeysGetKeyStringCall) Context ¶
func (c *ProjectsLocationsKeysGetKeyStringCall) Context(ctx context.Context) *ProjectsLocationsKeysGetKeyStringCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsKeysGetKeyStringCall) Do ¶
func (c *ProjectsLocationsKeysGetKeyStringCall) Do(opts ...googleapi.CallOption) (*V2GetKeyStringResponse, error)
Do executes the "apikeys.projects.locations.keys.getKeyString" call. Any non-2xx status code is an error. Response headers are in either *V2GetKeyStringResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsKeysGetKeyStringCall) Fields ¶
func (c *ProjectsLocationsKeysGetKeyStringCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysGetKeyStringCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsKeysGetKeyStringCall) Header ¶
func (c *ProjectsLocationsKeysGetKeyStringCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsLocationsKeysGetKeyStringCall) IfNoneMatch ¶
func (c *ProjectsLocationsKeysGetKeyStringCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeysGetKeyStringCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
type ProjectsLocationsKeysListCall ¶
type ProjectsLocationsKeysListCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsKeysListCall) Context ¶
func (c *ProjectsLocationsKeysListCall) Context(ctx context.Context) *ProjectsLocationsKeysListCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsKeysListCall) Do ¶
func (c *ProjectsLocationsKeysListCall) Do(opts ...googleapi.CallOption) (*V2ListKeysResponse, error)
Do executes the "apikeys.projects.locations.keys.list" call. Any non-2xx status code is an error. Response headers are in either *V2ListKeysResponse.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsKeysListCall) Fields ¶
func (c *ProjectsLocationsKeysListCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysListCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsKeysListCall) Header ¶
func (c *ProjectsLocationsKeysListCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsLocationsKeysListCall) IfNoneMatch ¶
func (c *ProjectsLocationsKeysListCall) IfNoneMatch(entityTag string) *ProjectsLocationsKeysListCall
IfNoneMatch sets an optional parameter which makes the operation fail if the object's ETag matches the given value. This is useful for getting updates only after the object has changed since the last request.
func (*ProjectsLocationsKeysListCall) PageSize ¶
func (c *ProjectsLocationsKeysListCall) PageSize(pageSize int64) *ProjectsLocationsKeysListCall
PageSize sets the optional parameter "pageSize": Specifies the maximum number of results to be returned at a time.
func (*ProjectsLocationsKeysListCall) PageToken ¶
func (c *ProjectsLocationsKeysListCall) PageToken(pageToken string) *ProjectsLocationsKeysListCall
PageToken sets the optional parameter "pageToken": Requests a specific page of results.
func (*ProjectsLocationsKeysListCall) Pages ¶
func (c *ProjectsLocationsKeysListCall) Pages(ctx context.Context, f func(*V2ListKeysResponse) error) error
Pages invokes f for each page of results. A non-nil error returned from f will halt the iteration. The provided context supersedes any context provided to the Context method.
func (*ProjectsLocationsKeysListCall) ShowDeleted ¶ added in v0.66.0
func (c *ProjectsLocationsKeysListCall) ShowDeleted(showDeleted bool) *ProjectsLocationsKeysListCall
ShowDeleted sets the optional parameter "showDeleted": Indicate that keys deleted in the past 30 days should also be returned.
type ProjectsLocationsKeysPatchCall ¶
type ProjectsLocationsKeysPatchCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsKeysPatchCall) Context ¶
func (c *ProjectsLocationsKeysPatchCall) Context(ctx context.Context) *ProjectsLocationsKeysPatchCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsKeysPatchCall) Do ¶
func (c *ProjectsLocationsKeysPatchCall) Do(opts ...googleapi.CallOption) (*Operation, error)
Do executes the "apikeys.projects.locations.keys.patch" call. Any non-2xx status code is an error. Response headers are in either *Operation.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsKeysPatchCall) Fields ¶
func (c *ProjectsLocationsKeysPatchCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysPatchCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsKeysPatchCall) Header ¶
func (c *ProjectsLocationsKeysPatchCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
func (*ProjectsLocationsKeysPatchCall) UpdateMask ¶
func (c *ProjectsLocationsKeysPatchCall) UpdateMask(updateMask string) *ProjectsLocationsKeysPatchCall
UpdateMask sets the optional parameter "updateMask": The field mask specifies which fields to be updated as part of this request. All other fields are ignored. Mutable fields are: `display_name`, `restrictions`, and `annotations`. If an update mask is not provided, the service treats it as an implied mask equivalent to all allowed fields that are set on the wire. If the field mask has a special value "*", the service treats it equivalent to replace all allowed mutable fields.
type ProjectsLocationsKeysService ¶
type ProjectsLocationsKeysService struct {
// contains filtered or unexported fields
}
func NewProjectsLocationsKeysService ¶
func NewProjectsLocationsKeysService(s *Service) *ProjectsLocationsKeysService
func (*ProjectsLocationsKeysService) Create ¶
func (r *ProjectsLocationsKeysService) Create(parent string, v2key *V2Key) *ProjectsLocationsKeysCreateCall
Create: Creates a new API key. NOTE: Key is a global resource; hence the only supported value for location is `global`.
- parent: The project in which the API key is created.
func (*ProjectsLocationsKeysService) Delete ¶
func (r *ProjectsLocationsKeysService) Delete(name string) *ProjectsLocationsKeysDeleteCall
Delete: Deletes an API key. Deleted key can be retrieved within 30 days of deletion. Afterward, key will be purged from the project. NOTE: Key is a global resource; hence the only supported value for location is `global`.
- name: The resource name of the API key to be deleted.
func (*ProjectsLocationsKeysService) Get ¶
func (r *ProjectsLocationsKeysService) Get(name string) *ProjectsLocationsKeysGetCall
Get: Gets the metadata for an API key. The key string of the API key isn't included in the response. NOTE: Key is a global resource; hence the only supported value for location is `global`.
- name: The resource name of the API key to get.
func (*ProjectsLocationsKeysService) GetKeyString ¶
func (r *ProjectsLocationsKeysService) GetKeyString(name string) *ProjectsLocationsKeysGetKeyStringCall
GetKeyString: Get the key string for an API key. NOTE: Key is a global resource; hence the only supported value for location is `global`.
- name: The resource name of the API key to be retrieved.
func (*ProjectsLocationsKeysService) List ¶
func (r *ProjectsLocationsKeysService) List(parent string) *ProjectsLocationsKeysListCall
List: Lists the API keys owned by a project. The key string of the API key isn't included in the response. NOTE: Key is a global resource; hence the only supported value for location is `global`.
- parent: Lists all API keys associated with this project.
func (*ProjectsLocationsKeysService) Patch ¶
func (r *ProjectsLocationsKeysService) Patch(name string, v2key *V2Key) *ProjectsLocationsKeysPatchCall
Patch: Patches the modifiable fields of an API key. The key string of the API key isn't included in the response. NOTE: Key is a global resource; hence the only supported value for location is `global`.
- name: Output only. The resource name of the key. The `name` has the form: `projects//locations/global/keys/`. For example: `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee 9b5dd2` NOTE: Key is a global resource; hence the only supported value for location is `global`.
func (*ProjectsLocationsKeysService) Undelete ¶
func (r *ProjectsLocationsKeysService) Undelete(name string, v2undeletekeyrequest *V2UndeleteKeyRequest) *ProjectsLocationsKeysUndeleteCall
Undelete: Undeletes an API key which was deleted within 30 days. NOTE: Key is a global resource; hence the only supported value for location is `global`.
- name: The resource name of the API key to be undeleted.
type ProjectsLocationsKeysUndeleteCall ¶
type ProjectsLocationsKeysUndeleteCall struct {
// contains filtered or unexported fields
}
func (*ProjectsLocationsKeysUndeleteCall) Context ¶
func (c *ProjectsLocationsKeysUndeleteCall) Context(ctx context.Context) *ProjectsLocationsKeysUndeleteCall
Context sets the context to be used in this call's Do method.
func (*ProjectsLocationsKeysUndeleteCall) Do ¶
func (c *ProjectsLocationsKeysUndeleteCall) Do(opts ...googleapi.CallOption) (*Operation, error)
Do executes the "apikeys.projects.locations.keys.undelete" call. Any non-2xx status code is an error. Response headers are in either *Operation.ServerResponse.Header or (if a response was returned at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check whether the returned error was because http.StatusNotModified was returned.
func (*ProjectsLocationsKeysUndeleteCall) Fields ¶
func (c *ProjectsLocationsKeysUndeleteCall) Fields(s ...googleapi.Field) *ProjectsLocationsKeysUndeleteCall
Fields allows partial responses to be retrieved. See https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more details.
func (*ProjectsLocationsKeysUndeleteCall) Header ¶
func (c *ProjectsLocationsKeysUndeleteCall) Header() http.Header
Header returns a http.Header that can be modified by the caller to add headers to the request.
type ProjectsLocationsService ¶
type ProjectsLocationsService struct { Keys *ProjectsLocationsKeysService // contains filtered or unexported fields }
func NewProjectsLocationsService ¶
func NewProjectsLocationsService(s *Service) *ProjectsLocationsService
type ProjectsService ¶
type ProjectsService struct { Locations *ProjectsLocationsService // contains filtered or unexported fields }
func NewProjectsService ¶
func NewProjectsService(s *Service) *ProjectsService
type Service ¶
type Service struct { BasePath string // API endpoint base URL UserAgent string // optional additional User-Agent fragment Keys *KeysService Operations *OperationsService Projects *ProjectsService // contains filtered or unexported fields }
func New
deprecated
New creates a new Service. It uses the provided http.Client for requests.
Deprecated: please use NewService instead. To provide a custom HTTP client, use option.WithHTTPClient. If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
func NewService ¶
NewService creates a new Service.
type Status ¶
type Status struct { // Code: The status code, which should be an enum value of google.rpc.Code. Code int64 `json:"code,omitempty"` // Details: A list of messages that carry the error details. There is a common // set of message types for APIs to use. Details []googleapi.RawMessage `json:"details,omitempty"` // Message: A developer-facing error message, which should be in English. Any // user-facing error message should be localized and sent in the // google.rpc.Status.details field, or localized by the client. Message string `json:"message,omitempty"` // ForceSendFields is a list of field names (e.g. "Code") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Code") to include in API requests // with the JSON null value. By default, fields with empty values are omitted // from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
Status: The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by gRPC (https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the API Design Guide (https://cloud.google.com/apis/design/errors).
func (*Status) MarshalJSON ¶
type V2AndroidApplication ¶
type V2AndroidApplication struct { // PackageName: The package name of the application. PackageName string `json:"packageName,omitempty"` // Sha1Fingerprint: The SHA1 fingerprint of the application. For example, both // sha1 formats are acceptable : // DA:39:A3:EE:5E:6B:4B:0D:32:55:BF:EF:95:60:18:90:AF:D8:07:09 or // DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output format is the latter. Sha1Fingerprint string `json:"sha1Fingerprint,omitempty"` // ForceSendFields is a list of field names (e.g. "PackageName") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "PackageName") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
V2AndroidApplication: Identifier of an Android application for key use.
func (*V2AndroidApplication) MarshalJSON ¶
func (s *V2AndroidApplication) MarshalJSON() ([]byte, error)
type V2AndroidKeyRestrictions ¶
type V2AndroidKeyRestrictions struct { // AllowedApplications: A list of Android applications that are allowed to make // API calls with this key. AllowedApplications []*V2AndroidApplication `json:"allowedApplications,omitempty"` // ForceSendFields is a list of field names (e.g. "AllowedApplications") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "AllowedApplications") to include // in API requests with the JSON null value. By default, fields with empty // values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
V2AndroidKeyRestrictions: The Android apps that are allowed to use the key.
func (*V2AndroidKeyRestrictions) MarshalJSON ¶
func (s *V2AndroidKeyRestrictions) MarshalJSON() ([]byte, error)
type V2ApiTarget ¶
type V2ApiTarget struct { // Methods: Optional. List of one or more methods that can be called. If empty, // all methods for the service are allowed. A wildcard (*) can be used as the // last symbol. Valid examples: // `google.cloud.translate.v2.TranslateService.GetSupportedLanguage` // `TranslateText` `Get*` `translate.googleapis.com.Get*` Methods []string `json:"methods,omitempty"` // Service: The service for this restriction. It should be the canonical // service name, for example: `translate.googleapis.com`. You can use `gcloud // services list` (/sdk/gcloud/reference/services/list) to get a list of // services that are enabled in the project. Service string `json:"service,omitempty"` // ForceSendFields is a list of field names (e.g. "Methods") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Methods") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
V2ApiTarget: A restriction for a specific service and optionally one or multiple specific methods. Both fields are case insensitive.
func (*V2ApiTarget) MarshalJSON ¶
func (s *V2ApiTarget) MarshalJSON() ([]byte, error)
type V2BrowserKeyRestrictions ¶
type V2BrowserKeyRestrictions struct { // AllowedReferrers: A list of regular expressions for the referrer URLs that // are allowed to make API calls with this key. AllowedReferrers []string `json:"allowedReferrers,omitempty"` // ForceSendFields is a list of field names (e.g. "AllowedReferrers") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "AllowedReferrers") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
V2BrowserKeyRestrictions: The HTTP referrers (websites) that are allowed to use the key.
func (*V2BrowserKeyRestrictions) MarshalJSON ¶
func (s *V2BrowserKeyRestrictions) MarshalJSON() ([]byte, error)
type V2GetKeyStringResponse ¶
type V2GetKeyStringResponse struct { // KeyString: An encrypted and signed value of the key. KeyString string `json:"keyString,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "KeyString") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "KeyString") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
V2GetKeyStringResponse: Response message for `GetKeyString` method.
func (*V2GetKeyStringResponse) MarshalJSON ¶
func (s *V2GetKeyStringResponse) MarshalJSON() ([]byte, error)
type V2IosKeyRestrictions ¶
type V2IosKeyRestrictions struct { // AllowedBundleIds: A list of bundle IDs that are allowed when making API // calls with this key. AllowedBundleIds []string `json:"allowedBundleIds,omitempty"` // ForceSendFields is a list of field names (e.g. "AllowedBundleIds") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "AllowedBundleIds") to include in // API requests with the JSON null value. By default, fields with empty values // are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
V2IosKeyRestrictions: The iOS apps that are allowed to use the key.
func (*V2IosKeyRestrictions) MarshalJSON ¶
func (s *V2IosKeyRestrictions) MarshalJSON() ([]byte, error)
type V2Key ¶
type V2Key struct { // Annotations: Annotations is an unstructured key-value map stored with a // policy that may be set by external tools to store and retrieve arbitrary // metadata. They are not queryable and should be preserved when modifying // objects. Annotations map[string]string `json:"annotations,omitempty"` // CreateTime: Output only. A timestamp identifying the time this key was // originally created. CreateTime string `json:"createTime,omitempty"` // DeleteTime: Output only. A timestamp when this key was deleted. If the // resource is not deleted, this must be empty. DeleteTime string `json:"deleteTime,omitempty"` // DisplayName: Human-readable display name of this key that you can modify. // The maximum length is 63 characters. DisplayName string `json:"displayName,omitempty"` // Etag: Output only. A checksum computed by the server based on the current // value of the Key resource. This may be sent on update and delete requests to // ensure the client has an up-to-date value before proceeding. See // https://google.aip.dev/154. Etag string `json:"etag,omitempty"` // KeyString: Output only. An encrypted and signed value held by this key. This // field can be accessed only through the `GetKeyString` method. KeyString string `json:"keyString,omitempty"` // Name: Output only. The resource name of the key. The `name` has the form: // `projects//locations/global/keys/`. For example: // `projects/123456867718/locations/global/keys/b7ff1f9f-8275-410a-94dd-3855ee9b // 5dd2` NOTE: Key is a global resource; hence the only supported value for // location is `global`. Name string `json:"name,omitempty"` // Restrictions: Key restrictions. Restrictions *V2Restrictions `json:"restrictions,omitempty"` // Uid: Output only. Unique id in UUID4 format. Uid string `json:"uid,omitempty"` // UpdateTime: Output only. A timestamp identifying the time this key was last // updated. UpdateTime string `json:"updateTime,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Annotations") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Annotations") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
V2Key: The representation of a key managed by the API Keys API.
func (*V2Key) MarshalJSON ¶
type V2ListKeysResponse ¶
type V2ListKeysResponse struct { // Keys: A list of API keys. Keys []*V2Key `json:"keys,omitempty"` // NextPageToken: The pagination token for the next page of results. NextPageToken string `json:"nextPageToken,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Keys") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Keys") to include in API requests // with the JSON null value. By default, fields with empty values are omitted // from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
V2ListKeysResponse: Response message for `ListKeys` method.
func (*V2ListKeysResponse) MarshalJSON ¶
func (s *V2ListKeysResponse) MarshalJSON() ([]byte, error)
type V2LookupKeyResponse ¶
type V2LookupKeyResponse struct { // Name: The resource name of the API key. If the API key has been purged, // resource name is empty. Name string `json:"name,omitempty"` // Parent: The project that owns the key with the value specified in the // request. Parent string `json:"parent,omitempty"` // ServerResponse contains the HTTP response code and headers from the server. googleapi.ServerResponse `json:"-"` // ForceSendFields is a list of field names (e.g. "Name") to unconditionally // include in API requests. By default, fields with empty or default values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "Name") to include in API requests // with the JSON null value. By default, fields with empty values are omitted // from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
V2LookupKeyResponse: Response message for `LookupKey` method.
func (*V2LookupKeyResponse) MarshalJSON ¶
func (s *V2LookupKeyResponse) MarshalJSON() ([]byte, error)
type V2Restrictions ¶
type V2Restrictions struct { // AndroidKeyRestrictions: The Android apps that are allowed to use the key. AndroidKeyRestrictions *V2AndroidKeyRestrictions `json:"androidKeyRestrictions,omitempty"` // ApiTargets: A restriction for a specific service and optionally one or more // specific methods. Requests are allowed if they match any of these // restrictions. If no restrictions are specified, all targets are allowed. ApiTargets []*V2ApiTarget `json:"apiTargets,omitempty"` // BrowserKeyRestrictions: The HTTP referrers (websites) that are allowed to // use the key. BrowserKeyRestrictions *V2BrowserKeyRestrictions `json:"browserKeyRestrictions,omitempty"` // IosKeyRestrictions: The iOS apps that are allowed to use the key. IosKeyRestrictions *V2IosKeyRestrictions `json:"iosKeyRestrictions,omitempty"` // ServerKeyRestrictions: The IP addresses of callers that are allowed to use // the key. ServerKeyRestrictions *V2ServerKeyRestrictions `json:"serverKeyRestrictions,omitempty"` // ForceSendFields is a list of field names (e.g. "AndroidKeyRestrictions") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "AndroidKeyRestrictions") to // include in API requests with the JSON null value. By default, fields with // empty values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
V2Restrictions: Describes the restrictions on the key.
func (*V2Restrictions) MarshalJSON ¶
func (s *V2Restrictions) MarshalJSON() ([]byte, error)
type V2ServerKeyRestrictions ¶
type V2ServerKeyRestrictions struct { // AllowedIps: A list of the caller IP addresses that are allowed to make API // calls with this key. AllowedIps []string `json:"allowedIps,omitempty"` // ForceSendFields is a list of field names (e.g. "AllowedIps") to // unconditionally include in API requests. By default, fields with empty or // default values are omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more // details. ForceSendFields []string `json:"-"` // NullFields is a list of field names (e.g. "AllowedIps") to include in API // requests with the JSON null value. By default, fields with empty values are // omitted from API requests. See // https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details. NullFields []string `json:"-"` }
V2ServerKeyRestrictions: The IP addresses of callers that are allowed to use the key.
func (*V2ServerKeyRestrictions) MarshalJSON ¶
func (s *V2ServerKeyRestrictions) MarshalJSON() ([]byte, error)
type V2UndeleteKeyRequest ¶
type V2UndeleteKeyRequest struct { }
V2UndeleteKeyRequest: Request message for `UndeleteKey` method.