apikeys

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 21, 2022 License: Apache-2.0 Imports: 11 Imported by: 4

Documentation

Overview

Copyright 2022 Google LLC. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package apikeys provides types and methods for managing apikeys GCP resources.

Copyright 2022 Google LLC. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package apikeys defines operations in the declarative SDK.

Copyright 2022 Google LLC. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2022 Google LLC. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const KeyMaxPage = -1

Variables

View Source
var YAML_key = []byte("info:\n  title: Apikeys/Key\n  description: The Apikeys Key resource\n  x-dcl-struct-name: Key\n  x-dcl-has-iam: false\npaths:\n  get:\n    description: The function used to get information about a Key\n    parameters:\n    - name: Key\n      required: true\n      description: A full instance of a Key\n  apply:\n    description: The function used to apply information about a Key\n    parameters:\n    - name: Key\n      required: true\n      description: A full instance of a Key\n  delete:\n    description: The function used to delete a Key\n    parameters:\n    - name: Key\n      required: true\n      description: A full instance of a Key\n  deleteAll:\n    description: The function used to delete all Key\n    parameters:\n    - name: project\n      required: true\n      schema:\n        type: string\n  list:\n    description: The function used to list information about many Key\n    parameters:\n    - name: project\n      required: true\n      schema:\n        type: string\ncomponents:\n  schemas:\n    Key:\n      title: Key\n      x-dcl-id: projects/{{project}}/locations/global/keys/{{name}}\n      x-dcl-locations:\n      - global\n      x-dcl-parent-container: project\n      x-dcl-has-iam: false\n      type: object\n      required:\n      - name\n      - project\n      properties:\n        displayName:\n          type: string\n          x-dcl-go-name: DisplayName\n          description: Human-readable display name of this API key. Modifiable by\n            user.\n        keyString:\n          type: string\n          x-dcl-go-name: KeyString\n          readOnly: true\n          description: Output only. An encrypted and signed value held by this key.\n            This field can be accessed only through the `GetKeyString` method.\n          x-kubernetes-immutable: true\n          x-dcl-sensitive: true\n        name:\n          type: string\n          x-dcl-go-name: Name\n          description: 'The resource name of the key. The name must be unique within\n            the project, must conform with RFC-1034, is restricted to lower-cased\n            letters, and has a maximum length of 63 characters. In another word, the\n            name must match the regular expression: [a-z]([a-z0-9-]{0,61}[a-z0-9])?.'\n          x-kubernetes-immutable: true\n        project:\n          type: string\n          x-dcl-go-name: Project\n          description: The project for the resource\n          x-kubernetes-immutable: true\n          x-dcl-references:\n          - resource: Cloudresourcemanager/Project\n            field: name\n            parent: true\n        restrictions:\n          type: object\n          x-dcl-go-name: Restrictions\n          x-dcl-go-type: KeyRestrictions\n          description: Key restrictions.\n          properties:\n            androidKeyRestrictions:\n              type: object\n              x-dcl-go-name: AndroidKeyRestrictions\n              x-dcl-go-type: KeyRestrictionsAndroidKeyRestrictions\n              description: The Android apps that are allowed to use the key.\n              x-dcl-conflicts:\n              - browserKeyRestrictions\n              - serverKeyRestrictions\n              - iosKeyRestrictions\n              required:\n              - allowedApplications\n              properties:\n                allowedApplications:\n                  type: array\n                  x-dcl-go-name: AllowedApplications\n                  description: A list of Android applications that are allowed to\n                    make API calls with this key.\n                  x-dcl-send-empty: true\n                  x-dcl-list-type: list\n                  items:\n                    type: object\n                    x-dcl-go-type: KeyRestrictionsAndroidKeyRestrictionsAllowedApplications\n                    required:\n                    - sha1Fingerprint\n                    - packageName\n                    properties:\n                      packageName:\n                        type: string\n                        x-dcl-go-name: PackageName\n                        description: The package name of the application.\n                      sha1Fingerprint:\n                        type: string\n                        x-dcl-go-name: Sha1Fingerprint\n                        description: 'The SHA1 fingerprint of the application. For\n                          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\n                          or DA39A3EE5E6B4B0D3255BFEF95601890AFD80709. Output format\n                          is the latter.'\n            apiTargets:\n              type: array\n              x-dcl-go-name: ApiTargets\n              description: A restriction for a specific service and optionally one\n                or more specific methods. Requests are allowed if they match any of\n                these restrictions. If no restrictions are specified, all targets\n                are allowed.\n              x-dcl-send-empty: true\n              x-dcl-list-type: list\n              items:\n                type: object\n                x-dcl-go-type: KeyRestrictionsApiTargets\n                required:\n                - service\n                properties:\n                  methods:\n                    type: array\n                    x-dcl-go-name: Methods\n                    description: 'Optional. List of one or more methods that can be\n                      called. If empty, all methods for the service are allowed. A\n                      wildcard (*) can be used as the last symbol. Valid examples:\n                      `google.cloud.translate.v2.TranslateService.GetSupportedLanguage`\n                      `TranslateText` `Get*` `translate.googleapis.com.Get*`'\n                    x-dcl-send-empty: true\n                    x-dcl-list-type: list\n                    items:\n                      type: string\n                      x-dcl-go-type: string\n                  service:\n                    type: string\n                    x-dcl-go-name: Service\n                    description: 'The service for this restriction. It should be the\n                      canonical service name, for example: `translate.googleapis.com`.\n                      You can use `gcloud services list` to get a list of services\n                      that are enabled in the project.'\n            browserKeyRestrictions:\n              type: object\n              x-dcl-go-name: BrowserKeyRestrictions\n              x-dcl-go-type: KeyRestrictionsBrowserKeyRestrictions\n              description: The HTTP referrers (websites) that are allowed to use the\n                key.\n              x-dcl-conflicts:\n              - serverKeyRestrictions\n              - androidKeyRestrictions\n              - iosKeyRestrictions\n              required:\n              - allowedReferrers\n              properties:\n                allowedReferrers:\n                  type: array\n                  x-dcl-go-name: AllowedReferrers\n                  description: A list of regular expressions for the referrer URLs\n                    that are allowed to make API calls with this key.\n                  x-dcl-send-empty: true\n                  x-dcl-list-type: list\n                  items:\n                    type: string\n                    x-dcl-go-type: string\n            iosKeyRestrictions:\n              type: object\n              x-dcl-go-name: IosKeyRestrictions\n              x-dcl-go-type: KeyRestrictionsIosKeyRestrictions\n              description: The iOS apps that are allowed to use the key.\n              x-dcl-conflicts:\n              - browserKeyRestrictions\n              - serverKeyRestrictions\n              - androidKeyRestrictions\n              required:\n              - allowedBundleIds\n              properties:\n                allowedBundleIds:\n                  type: array\n                  x-dcl-go-name: AllowedBundleIds\n                  description: A list of bundle IDs that are allowed when making API\n                    calls with this key.\n                  x-dcl-send-empty: true\n                  x-dcl-list-type: list\n                  items:\n                    type: string\n                    x-dcl-go-type: string\n            serverKeyRestrictions:\n              type: object\n              x-dcl-go-name: ServerKeyRestrictions\n              x-dcl-go-type: KeyRestrictionsServerKeyRestrictions\n              description: The IP addresses of callers that are allowed to use the\n                key.\n              x-dcl-conflicts:\n              - browserKeyRestrictions\n              - androidKeyRestrictions\n              - iosKeyRestrictions\n              required:\n              - allowedIps\n              properties:\n                allowedIps:\n                  type: array\n                  x-dcl-go-name: AllowedIps\n                  description: A list of the caller IP addresses that are allowed\n                    to make API calls with this key.\n                  x-dcl-send-empty: true\n                  x-dcl-list-type: list\n                  items:\n                    type: string\n                    x-dcl-go-type: string\n")

blaze-out/k8-fastbuild/genfiles/cloud/graphite/mmv2/services/google/apikeys/key.yaml

Functions

This section is empty.

Types

type Client

type Client struct {
	Config *dcl.Config
}

The Client is the base struct of all operations. This will receive the Get, Delete, List, and Apply operations on all resources.

func NewClient

func NewClient(c *dcl.Config) *Client

NewClient creates a client that retries all operations a few times each.

func (*Client) ApplyKey

func (c *Client) ApplyKey(ctx context.Context, rawDesired *Key, opts ...dcl.ApplyOption) (*Key, error)

func (*Client) DeleteAllKey

func (c *Client) DeleteAllKey(ctx context.Context, project string, filter func(*Key) bool) error

DeleteAllKey deletes all resources that the filter functions returns true on.

func (*Client) DeleteKey

func (c *Client) DeleteKey(ctx context.Context, r *Key) error

func (*Client) GetKey

func (c *Client) GetKey(ctx context.Context, r *Key) (*Key, error)

func (*Client) ListKey

func (c *Client) ListKey(ctx context.Context, project string) (*KeyList, error)

func (*Client) ListKeyWithMaxResults

func (c *Client) ListKeyWithMaxResults(ctx context.Context, project string, pageSize int32) (*KeyList, error)

type Key

type Key struct {
	Name         *string          `json:"name"`
	DisplayName  *string          `json:"displayName"`
	KeyString    *string          `json:"keyString"`
	Restrictions *KeyRestrictions `json:"restrictions"`
	Project      *string          `json:"project"`
}

func (*Key) Describe

func (r *Key) Describe() dcl.ServiceTypeVersion

Describe returns a simple description of this resource to ensure that automated tools can identify it.

func (*Key) ID

func (r *Key) ID() (string, error)

func (*Key) String

func (r *Key) String() string

type KeyList

type KeyList struct {
	Items []*Key
	// contains filtered or unexported fields
}

func (*KeyList) HasNext

func (l *KeyList) HasNext() bool

func (*KeyList) Next

func (l *KeyList) Next(ctx context.Context, c *Client) error

type KeyRestrictions

type KeyRestrictions struct {
	BrowserKeyRestrictions *KeyRestrictionsBrowserKeyRestrictions `json:"browserKeyRestrictions"`
	ServerKeyRestrictions  *KeyRestrictionsServerKeyRestrictions  `json:"serverKeyRestrictions"`
	AndroidKeyRestrictions *KeyRestrictionsAndroidKeyRestrictions `json:"androidKeyRestrictions"`
	IosKeyRestrictions     *KeyRestrictionsIosKeyRestrictions     `json:"iosKeyRestrictions"`
	ApiTargets             []KeyRestrictionsApiTargets            `json:"apiTargets"`
	// contains filtered or unexported fields
}
var EmptyKeyRestrictions *KeyRestrictions = &KeyRestrictions{empty: true}

This object is used to assert a desired state where this KeyRestrictions is empty. Go lacks global const objects, but this object should be treated as one. Modifying this object will have undesirable results.

func (*KeyRestrictions) Empty

func (r *KeyRestrictions) Empty() bool

func (*KeyRestrictions) HashCode

func (r *KeyRestrictions) HashCode() string

func (*KeyRestrictions) String

func (r *KeyRestrictions) String() string

func (*KeyRestrictions) UnmarshalJSON

func (r *KeyRestrictions) UnmarshalJSON(data []byte) error

type KeyRestrictionsAndroidKeyRestrictions

type KeyRestrictionsAndroidKeyRestrictions struct {
	AllowedApplications []KeyRestrictionsAndroidKeyRestrictionsAllowedApplications `json:"allowedApplications"`
	// contains filtered or unexported fields
}
var EmptyKeyRestrictionsAndroidKeyRestrictions *KeyRestrictionsAndroidKeyRestrictions = &KeyRestrictionsAndroidKeyRestrictions{empty: true}

This object is used to assert a desired state where this KeyRestrictionsAndroidKeyRestrictions is empty. Go lacks global const objects, but this object should be treated as one. Modifying this object will have undesirable results.

func (*KeyRestrictionsAndroidKeyRestrictions) Empty

func (*KeyRestrictionsAndroidKeyRestrictions) HashCode

func (*KeyRestrictionsAndroidKeyRestrictions) String

func (*KeyRestrictionsAndroidKeyRestrictions) UnmarshalJSON

func (r *KeyRestrictionsAndroidKeyRestrictions) UnmarshalJSON(data []byte) error

type KeyRestrictionsAndroidKeyRestrictionsAllowedApplications

type KeyRestrictionsAndroidKeyRestrictionsAllowedApplications struct {
	Sha1Fingerprint *string `json:"sha1Fingerprint"`
	PackageName     *string `json:"packageName"`
	// contains filtered or unexported fields
}
var EmptyKeyRestrictionsAndroidKeyRestrictionsAllowedApplications *KeyRestrictionsAndroidKeyRestrictionsAllowedApplications = &KeyRestrictionsAndroidKeyRestrictionsAllowedApplications{empty: true}

This object is used to assert a desired state where this KeyRestrictionsAndroidKeyRestrictionsAllowedApplications is empty. Go lacks global const objects, but this object should be treated as one. Modifying this object will have undesirable results.

func (*KeyRestrictionsAndroidKeyRestrictionsAllowedApplications) Empty

func (*KeyRestrictionsAndroidKeyRestrictionsAllowedApplications) HashCode

func (*KeyRestrictionsAndroidKeyRestrictionsAllowedApplications) String

func (*KeyRestrictionsAndroidKeyRestrictionsAllowedApplications) UnmarshalJSON

type KeyRestrictionsApiTargets

type KeyRestrictionsApiTargets struct {
	Service *string  `json:"service"`
	Methods []string `json:"methods"`
	// contains filtered or unexported fields
}
var EmptyKeyRestrictionsApiTargets *KeyRestrictionsApiTargets = &KeyRestrictionsApiTargets{empty: true}

This object is used to assert a desired state where this KeyRestrictionsApiTargets is empty. Go lacks global const objects, but this object should be treated as one. Modifying this object will have undesirable results.

func (*KeyRestrictionsApiTargets) Empty

func (r *KeyRestrictionsApiTargets) Empty() bool

func (*KeyRestrictionsApiTargets) HashCode

func (r *KeyRestrictionsApiTargets) HashCode() string

func (*KeyRestrictionsApiTargets) String

func (r *KeyRestrictionsApiTargets) String() string

func (*KeyRestrictionsApiTargets) UnmarshalJSON

func (r *KeyRestrictionsApiTargets) UnmarshalJSON(data []byte) error

type KeyRestrictionsBrowserKeyRestrictions

type KeyRestrictionsBrowserKeyRestrictions struct {
	AllowedReferrers []string `json:"allowedReferrers"`
	// contains filtered or unexported fields
}
var EmptyKeyRestrictionsBrowserKeyRestrictions *KeyRestrictionsBrowserKeyRestrictions = &KeyRestrictionsBrowserKeyRestrictions{empty: true}

This object is used to assert a desired state where this KeyRestrictionsBrowserKeyRestrictions is empty. Go lacks global const objects, but this object should be treated as one. Modifying this object will have undesirable results.

func (*KeyRestrictionsBrowserKeyRestrictions) Empty

func (*KeyRestrictionsBrowserKeyRestrictions) HashCode

func (*KeyRestrictionsBrowserKeyRestrictions) String

func (*KeyRestrictionsBrowserKeyRestrictions) UnmarshalJSON

func (r *KeyRestrictionsBrowserKeyRestrictions) UnmarshalJSON(data []byte) error

type KeyRestrictionsIosKeyRestrictions

type KeyRestrictionsIosKeyRestrictions struct {
	AllowedBundleIds []string `json:"allowedBundleIds"`
	// contains filtered or unexported fields
}
var EmptyKeyRestrictionsIosKeyRestrictions *KeyRestrictionsIosKeyRestrictions = &KeyRestrictionsIosKeyRestrictions{empty: true}

This object is used to assert a desired state where this KeyRestrictionsIosKeyRestrictions is empty. Go lacks global const objects, but this object should be treated as one. Modifying this object will have undesirable results.

func (*KeyRestrictionsIosKeyRestrictions) Empty

func (*KeyRestrictionsIosKeyRestrictions) HashCode

func (*KeyRestrictionsIosKeyRestrictions) String

func (*KeyRestrictionsIosKeyRestrictions) UnmarshalJSON

func (r *KeyRestrictionsIosKeyRestrictions) UnmarshalJSON(data []byte) error

type KeyRestrictionsServerKeyRestrictions

type KeyRestrictionsServerKeyRestrictions struct {
	AllowedIps []string `json:"allowedIps"`
	// contains filtered or unexported fields
}
var EmptyKeyRestrictionsServerKeyRestrictions *KeyRestrictionsServerKeyRestrictions = &KeyRestrictionsServerKeyRestrictions{empty: true}

This object is used to assert a desired state where this KeyRestrictionsServerKeyRestrictions is empty. Go lacks global const objects, but this object should be treated as one. Modifying this object will have undesirable results.

func (*KeyRestrictionsServerKeyRestrictions) Empty

func (*KeyRestrictionsServerKeyRestrictions) HashCode

func (*KeyRestrictionsServerKeyRestrictions) String

func (*KeyRestrictionsServerKeyRestrictions) UnmarshalJSON

func (r *KeyRestrictionsServerKeyRestrictions) UnmarshalJSON(data []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL