beta

package
v1.25.0 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2022 License: Apache-2.0 Imports: 10 Imported by: 2

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 beta 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. Package orgpolicy defines types and methods for working with orgpolicy 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.

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 PolicyMaxPage = -1

Variables

View Source
var YAML_policy = []byte("info:\n  title: OrgPolicy/Policy\n  description: An organization policy gives you programmatic control over your organization's\n    cloud resources.  Using Organization Policies, you will be able to configure constraints\n    across your entire resource hierarchy.\n  x-dcl-struct-name: Policy\n  x-dcl-has-iam: false\n  x-dcl-ref:\n    text: REST API\n    url: https://cloud.google.com/resource-manager/docs/reference/orgpolicy/rest/v2/organizations.policies\n  x-dcl-guides:\n  - text: Understanding Org Policy concepts\n    url: https://cloud.google.com/resource-manager/docs/organization-policy/overview\n  - text: The resource hierarchy\n    url: https://cloud.google.com/resource-manager/docs/cloud-platform-resource-hierarchy\n  - text: All valid constraints\n    url: https://cloud.google.com/resource-manager/docs/organization-policy/org-policy-constraints\npaths:\n  get:\n    description: The function used to get information about a Policy\n    parameters:\n    - name: policy\n      required: true\n      description: A full instance of a Policy\n  apply:\n    description: The function used to apply information about a Policy\n    parameters:\n    - name: policy\n      required: true\n      description: A full instance of a Policy\n  delete:\n    description: The function used to delete a Policy\n    parameters:\n    - name: policy\n      required: true\n      description: A full instance of a Policy\n  deleteAll:\n    description: The function used to delete all Policy\n    parameters:\n    - name: parent\n      required: true\n      schema:\n        type: string\n  list:\n    description: The function used to list information about many Policy\n    parameters:\n    - name: parent\n      required: true\n      schema:\n        type: string\ncomponents:\n  schemas:\n    Policy:\n      title: Policy\n      x-dcl-id: '{{parent}}/policies/{{name}}'\n      x-dcl-has-create: true\n      x-dcl-has-iam: false\n      x-dcl-read-timeout: 0\n      x-dcl-apply-timeout: 0\n      x-dcl-delete-timeout: 0\n      type: object\n      required:\n      - name\n      - parent\n      properties:\n        name:\n          type: string\n          x-dcl-go-name: Name\n          description: 'Immutable. The resource name of the Policy. Must be one of\n            the following forms, where constraint_name is the name of the constraint\n            which this Policy configures: * `projects/{project_number}/policies/{constraint_name}`\n            * `folders/{folder_id}/policies/{constraint_name}` * `organizations/{organization_id}/policies/{constraint_name}`\n            For example, \"projects/123/policies/compute.disableSerialPortAccess\".\n            Note: `projects/{project_id}/policies/{constraint_name}` is also an acceptable\n            name for API requests, but responses will return the name using the equivalent\n            project number.'\n          x-kubernetes-immutable: true\n        parent:\n          type: string\n          x-dcl-go-name: Parent\n          description: The parent of the resource.\n          x-kubernetes-immutable: true\n          x-dcl-forward-slash-allowed: true\n          x-dcl-references:\n          - resource: Cloudresourcemanager/Folder\n            field: name\n            parent: true\n          - resource: Cloudresourcemanager/Organization\n            field: name\n            parent: true\n          - resource: Cloudresourcemanager/Project\n            field: name\n            parent: true\n        spec:\n          type: object\n          x-dcl-go-name: Spec\n          x-dcl-go-type: PolicySpec\n          description: Basic information about the Organization Policy.\n          properties:\n            etag:\n              type: string\n              x-dcl-go-name: Etag\n              readOnly: true\n              description: An opaque tag indicating the current version of the `Policy`,\n                used for concurrency control. This field is ignored if used in a `CreatePolicy`\n                request. When the `Policy` is returned from either a `GetPolicy` or\n                a `ListPolicies` request, this `etag` indicates the version of the\n                current `Policy` to use when executing a read-modify-write loop. When\n                the `Policy` is returned from a `GetEffectivePolicy` request, the\n                `etag` will be unset.\n            inheritFromParent:\n              type: boolean\n              x-dcl-go-name: InheritFromParent\n              description: Determines the inheritance behavior for this `Policy`.\n                If `inherit_from_parent` is true, PolicyRules set higher up in the\n                hierarchy (up to the closest root) are inherited and present in the\n                effective policy. If it is false, then no rules are inherited, and\n                this Policy becomes the new root for evaluation. This field can be\n                set only for Policies which configure list constraints.\n            reset:\n              type: boolean\n              x-dcl-go-name: Reset\n              description: Ignores policies set above this resource and restores the\n                `constraint_default` enforcement behavior of the specific `Constraint`\n                at this resource. This field can be set in policies for either list\n                or boolean constraints. If set, `rules` must be empty and `inherit_from_parent`\n                must be set to false.\n            rules:\n              type: array\n              x-dcl-go-name: Rules\n              description: 'Up to 10 PolicyRules are allowed. In Policies for boolean\n                constraints, the following requirements apply: - There must be one\n                and only one PolicyRule where condition is unset. - BooleanPolicyRules\n                with conditions must set `enforced` to the opposite of the PolicyRule\n                without a condition. - During policy evaluation, PolicyRules with\n                conditions that are true for a target resource take precedence.'\n              x-dcl-send-empty: true\n              x-dcl-list-type: list\n              items:\n                type: object\n                x-dcl-go-type: PolicySpecRules\n                properties:\n                  allowAll:\n                    type: boolean\n                    x-dcl-go-name: AllowAll\n                    description: Setting this to true means that all values are allowed.\n                      This field can be set only in Policies for list constraints.\n                    x-dcl-conflicts:\n                    - values\n                    - denyAll\n                    - enforce\n                  condition:\n                    type: object\n                    x-dcl-go-name: Condition\n                    x-dcl-go-type: PolicySpecRulesCondition\n                    description: 'A condition which determines whether this rule is\n                      used in the evaluation of the policy. When set, the `expression`\n                      field in the `Expr'' must include from 1 to 10 subexpressions,\n                      joined by the \"||\" or \"&&\" operators. Each subexpression must\n                      be of the form \"resource.matchTag(''/tag_key_short_name, ''tag_value_short_name'')\".\n                      or \"resource.matchTagId(''tagKeys/key_id'', ''tagValues/value_id'')\".\n                      where key_name and value_name are the resource names for Label\n                      Keys and Values. These names are available from the Tag Manager\n                      Service. An example expression is: \"resource.matchTag(''123456789/environment,\n                      ''prod'')\". or \"resource.matchTagId(''tagKeys/123'', ''tagValues/456'')\".'\n                    properties:\n                      description:\n                        type: string\n                        x-dcl-go-name: Description\n                        description: Optional. Description of the expression. This\n                          is a longer text which describes the expression, e.g. when\n                          hovered over it in a UI.\n                      expression:\n                        type: string\n                        x-dcl-go-name: Expression\n                        description: Textual representation of an expression in Common\n                          Expression Language syntax.\n                      location:\n                        type: string\n                        x-dcl-go-name: Location\n                        description: Optional. String indicating the location of the\n                          expression for error reporting, e.g. a file name and a position\n                          in the file.\n                      title:\n                        type: string\n                        x-dcl-go-name: Title\n                        description: Optional. Title for the expression, i.e. a short\n                          string describing its purpose. This can be used e.g. in\n                          UIs which allow to enter the expression.\n                  denyAll:\n                    type: boolean\n                    x-dcl-go-name: DenyAll\n                    description: Setting this to true means that all values are denied.\n                      This field can be set only in Policies for list constraints.\n                    x-dcl-conflicts:\n                    - values\n                    - allowAll\n                    - enforce\n                  enforce:\n                    type: boolean\n                    x-dcl-go-name: Enforce\n                    description: If `true`, then the `Policy` is enforced. If `false`,\n                      then any configuration is acceptable. This field can be set\n                      only in Policies for boolean constraints.\n                    x-dcl-conflicts:\n                    - values\n                    - allowAll\n                    - denyAll\n                  values:\n                    type: object\n                    x-dcl-go-name: Values\n                    x-dcl-go-type: PolicySpecRulesValues\n                    description: List of values to be used for this PolicyRule. This\n                      field can be set only in Policies for list constraints.\n                    x-dcl-conflicts:\n                    - allowAll\n                    - denyAll\n                    - enforce\n                    properties:\n                      allowedValues:\n                        type: array\n                        x-dcl-go-name: AllowedValues\n                        description: List of values allowed at this resource.\n                        x-dcl-send-empty: true\n                        x-dcl-list-type: list\n                        items:\n                          type: string\n                          x-dcl-go-type: string\n                      deniedValues:\n                        type: array\n                        x-dcl-go-name: DeniedValues\n                        description: List of values denied at this resource.\n                        x-dcl-send-empty: true\n                        x-dcl-list-type: list\n                        items:\n                          type: string\n                          x-dcl-go-type: string\n            updateTime:\n              type: string\n              format: date-time\n              x-dcl-go-name: UpdateTime\n              readOnly: true\n              description: Output only. The time stamp this was previously updated.\n                This represents the last time a call to `CreatePolicy` or `UpdatePolicy`\n                was made for that `Policy`.\n")

blaze-out/k8-fastbuild/genfiles/cloud/graphite/mmv2/services/google/orgpolicy/beta/policy.yaml

Functions

func DCLPolicySchema added in v1.10.3

func DCLPolicySchema() *dcl.Schema

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) ApplyPolicy

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

func (*Client) DeleteAllPolicy

func (c *Client) DeleteAllPolicy(ctx context.Context, parent string, filter func(*Policy) bool) error

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

func (*Client) DeletePolicy

func (c *Client) DeletePolicy(ctx context.Context, r *Policy) error

func (*Client) GetPolicy

func (c *Client) GetPolicy(ctx context.Context, r *Policy) (*Policy, error)

func (*Client) ListPolicy

func (c *Client) ListPolicy(ctx context.Context, parent string) (*PolicyList, error)

func (*Client) ListPolicyWithMaxResults

func (c *Client) ListPolicyWithMaxResults(ctx context.Context, parent string, pageSize int32) (*PolicyList, error)

type Policy

type Policy struct {
	Name   *string     `json:"name"`
	Spec   *PolicySpec `json:"spec"`
	Parent *string     `json:"parent"`
}

func (*Policy) Describe

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

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

func (*Policy) ID

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

func (*Policy) String

func (r *Policy) String() string

type PolicyList

type PolicyList struct {
	Items []*Policy
	// contains filtered or unexported fields
}

func (*PolicyList) HasNext

func (l *PolicyList) HasNext() bool

func (*PolicyList) Next

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

type PolicySpec

type PolicySpec struct {
	Etag              *string           `json:"etag"`
	UpdateTime        *string           `json:"updateTime"`
	Rules             []PolicySpecRules `json:"rules"`
	InheritFromParent *bool             `json:"inheritFromParent"`
	Reset             *bool             `json:"reset"`
	// contains filtered or unexported fields
}
var EmptyPolicySpec *PolicySpec = &PolicySpec{empty: true}

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

func (*PolicySpec) Empty

func (r *PolicySpec) Empty() bool

func (*PolicySpec) HashCode

func (r *PolicySpec) HashCode() string

func (*PolicySpec) String

func (r *PolicySpec) String() string

func (*PolicySpec) UnmarshalJSON

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

type PolicySpecRules

type PolicySpecRules struct {
	Values    *PolicySpecRulesValues    `json:"values"`
	AllowAll  *bool                     `json:"allowAll"`
	DenyAll   *bool                     `json:"denyAll"`
	Enforce   *bool                     `json:"enforce"`
	Condition *PolicySpecRulesCondition `json:"condition"`
	// contains filtered or unexported fields
}
var EmptyPolicySpecRules *PolicySpecRules = &PolicySpecRules{empty: true}

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

func (*PolicySpecRules) Empty

func (r *PolicySpecRules) Empty() bool

func (*PolicySpecRules) HashCode

func (r *PolicySpecRules) HashCode() string

func (*PolicySpecRules) String

func (r *PolicySpecRules) String() string

func (*PolicySpecRules) UnmarshalJSON

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

type PolicySpecRulesCondition

type PolicySpecRulesCondition struct {
	Expression  *string `json:"expression"`
	Title       *string `json:"title"`
	Description *string `json:"description"`
	Location    *string `json:"location"`
	// contains filtered or unexported fields
}
var EmptyPolicySpecRulesCondition *PolicySpecRulesCondition = &PolicySpecRulesCondition{empty: true}

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

func (*PolicySpecRulesCondition) Empty

func (r *PolicySpecRulesCondition) Empty() bool

func (*PolicySpecRulesCondition) HashCode

func (r *PolicySpecRulesCondition) HashCode() string

func (*PolicySpecRulesCondition) String

func (r *PolicySpecRulesCondition) String() string

func (*PolicySpecRulesCondition) UnmarshalJSON

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

type PolicySpecRulesValues

type PolicySpecRulesValues struct {
	AllowedValues []string `json:"allowedValues"`
	DeniedValues  []string `json:"deniedValues"`
	// contains filtered or unexported fields
}
var EmptyPolicySpecRulesValues *PolicySpecRulesValues = &PolicySpecRulesValues{empty: true}

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

func (*PolicySpecRulesValues) Empty

func (r *PolicySpecRulesValues) Empty() bool

func (*PolicySpecRulesValues) HashCode

func (r *PolicySpecRulesValues) HashCode() string

func (*PolicySpecRulesValues) String

func (r *PolicySpecRulesValues) String() string

func (*PolicySpecRulesValues) UnmarshalJSON

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

Jump to

Keyboard shortcuts

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