iamutil

package
v0.18.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: MPL-2.0 Imports: 12 Imported by: 1

Documentation

Overview

THIS FILE IS AUTOGENERATED USING go generate. DO NOT EDIT.

Index

Constants

View Source
const (
	ServiceAccountMemberTmpl = "serviceAccount:%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessBinding added in v0.6.2

type AccessBinding struct {
	Role         string `json:"role,omitempty"`
	UserByEmail  string `json:"userByEmail,omitempty"`
	GroupByEmail string `json:"groupByEmail,omitempty"`
}

NOTE: BigQuery does not conform to the typical REST for IAM policies instead it has an access array with bindings on the dataset object. https://cloud.google.com/bigquery/docs/reference/rest/v2/datasets#Dataset

type ApiHandle added in v0.6.2

type ApiHandle struct {
	// contains filtered or unexported fields
}

func GetApiHandle added in v0.6.2

func GetApiHandle(client *http.Client, userAgent string) *ApiHandle

func (*ApiHandle) DoGetRequest added in v0.6.2

func (h *ApiHandle) DoGetRequest(ctx context.Context, r Resource, out interface{}) (err error)

func (*ApiHandle) DoSetRequest added in v0.6.2

func (h *ApiHandle) DoSetRequest(ctx context.Context, r Resource, data io.Reader, out interface{}) error

type Binding

type Binding struct {
	Members   []string   `json:"members,omitempty"`
	Role      string     `json:"role,omitempty"`
	Condition *Condition `json:"condition,omitempty"`
}

type Condition added in v0.6.0

type Condition struct {
	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	Expression  string `json:"expression,omitempty"`
}

type Dataset added in v0.6.2

type Dataset struct {
	Access []*AccessBinding `json:"access,omitempty"`
	Etag   string           `json:"etag,omitempty"`
}

type DatasetResource added in v0.6.2

type DatasetResource struct {
	// contains filtered or unexported fields
}

NOTE: DatasetResource implements IamResource. This is because bigquery datasets have their own ACLs instead of an IAM policy

func (*DatasetResource) GetConfig added in v0.6.2

func (r *DatasetResource) GetConfig() *RestResource

func (*DatasetResource) GetIamPolicy added in v0.6.2

func (r *DatasetResource) GetIamPolicy(ctx context.Context, h *ApiHandle) (*Policy, error)

func (*DatasetResource) GetRelativeId added in v0.6.2

func (r *DatasetResource) GetRelativeId() *gcputil.RelativeResourceName

func (*DatasetResource) SetIamPolicy added in v0.6.2

func (r *DatasetResource) SetIamPolicy(ctx context.Context, h *ApiHandle, p *Policy) (*Policy, error)

type GeneratedResources

type GeneratedResources map[string]map[string]map[string]RestResource

GeneratedResources implements ResourceParser - a value is generated using internal/generate_iam.go

func GetEnabledResources added in v0.6.2

func GetEnabledResources() GeneratedResources

func (GeneratedResources) GetRestConfig

func (apis GeneratedResources) GetRestConfig(rawName string, fullName *gcputil.FullResourceName, prefix string) (*RestResource, error)

func (GeneratedResources) Parse

func (apis GeneratedResources) Parse(rawName string) (Resource, error)

type IamResource

type IamResource struct {
	// contains filtered or unexported fields
}

IamResource implements Resource.

func (*IamResource) GetConfig added in v0.6.2

func (r *IamResource) GetConfig() *RestResource

func (*IamResource) GetIamPolicy added in v0.6.2

func (r *IamResource) GetIamPolicy(ctx context.Context, h *ApiHandle) (*Policy, error)

func (*IamResource) GetRelativeId added in v0.6.2

func (r *IamResource) GetRelativeId() *gcputil.RelativeResourceName

func (*IamResource) SetIamPolicy added in v0.6.2

func (r *IamResource) SetIamPolicy(ctx context.Context, h *ApiHandle, p *Policy) (*Policy, error)

type Policy

type Policy struct {
	Bindings []*Binding `json:"bindings,omitempty"`
	Etag     string     `json:"etag,omitempty"`
	Version  int        `json:"version,omitempty"`
}

func (*Policy) AddBindings

func (p *Policy) AddBindings(toAdd *PolicyDelta) (changed bool, updated *Policy)

func (*Policy) ChangeBindings added in v0.10.1

func (p *Policy) ChangeBindings(toAdd *PolicyDelta, toRemove *PolicyDelta) (changed bool, updated *Policy)

func (*Policy) RemoveBindings

func (p *Policy) RemoveBindings(toRemove *PolicyDelta) (changed bool, updated *Policy)

type PolicyDelta

type PolicyDelta struct {
	Roles util.StringSet
	Email string
}

type Resource added in v0.6.2

type Resource interface {
	GetIamPolicy(context.Context, *ApiHandle) (*Policy, error)
	SetIamPolicy(context.Context, *ApiHandle, *Policy) (*Policy, error)
	GetConfig() *RestResource
	GetRelativeId() *gcputil.RelativeResourceName
}

Resource handles constructing HTTP requests for getting and setting IAM policies.

type ResourceParser added in v0.6.2

type ResourceParser interface {
	Parse(string) (Resource, error)
}

ResourceParser handles parsing resource ID and REST config from a given resource ID or name.

type RestMethod

type RestMethod struct {
	HttpMethod    string
	BaseURL       string
	Path          string
	RequestFormat string
}

type RestResource added in v0.6.2

type RestResource struct {
	// Name is the base name of the resource
	// i.e. for a GCE instance: "instance"
	Name string

	// TypeKey is the identifying path for the resource, or
	// the RESTful resource identifier without resource IDs
	// i.e. For a GCE instance: "projects/zones/instances"
	TypeKey string

	// Service is the name of the service this resource belongs to.
	Service string

	// IsPreferredVersion is true if this version of the API/resource is preferred.
	IsPreferredVersion bool

	// HTTP metadata for getting Policy data in GCP
	GetMethod RestMethod

	// HTTP metadata for setting Policy data in GCP
	SetMethod RestMethod

	// Ordered parameters to be replaced in method paths
	Parameters []string

	// Mapping of collection ids onto the parameter to be replaced
	CollectionReplacementKeys map[string]string
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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