iam

package
v1.70.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_RATE_LIMITER_RATE = int64(1000)
View Source
const MAX_RATE_LIMITER_RATE = int64(5000)

Variables

View Source
var DISABLE_RATE_LIMITER = (os.Getenv("DYNATRACE_DISABLE_IAM_RATE_LIMITER") == "true")
View Source
var PolicyLevels = struct {
	Global      PolicyLevel
	Account     PolicyLevel
	Environment PolicyLevel
}{
	PolicyLevel("global"),
	PolicyLevel("account"),
	PolicyLevel("environment"),
}

Functions

func GET added in v1.57.0

func GET(client IAMClient, ctx context.Context, url string, expectedResponseCode int, forceNewBearer bool, target any) error

Types

type AccountPolicyServiceClient

type AccountPolicyServiceClient struct {
	PolicyClient *BasePolicyServiceClient
}

func NewAccountPolicyService

func NewAccountPolicyService(clientID string, accountID string, clientSecret string, tokenURL string, endpointURL string) *AccountPolicyServiceClient

func (*AccountPolicyServiceClient) CREATE

func (me *AccountPolicyServiceClient) CREATE(ctx context.Context, policy *Policy) (string, error)

func (*AccountPolicyServiceClient) DELETE

func (me *AccountPolicyServiceClient) DELETE(ctx context.Context, level PolicyLevel, levelID string, uuid string) error

func (*AccountPolicyServiceClient) GET

func (me *AccountPolicyServiceClient) GET(ctx context.Context, levelID string, uuid string) (*Policy, error)

func (*AccountPolicyServiceClient) LIST

func (me *AccountPolicyServiceClient) LIST(ctx context.Context, level PolicyLevel, levelID string) ([]string, error)

func (*AccountPolicyServiceClient) List

func (*AccountPolicyServiceClient) UPDATE

func (me *AccountPolicyServiceClient) UPDATE(ctx context.Context, policy *Policy, uuid string) error

type Authenticator

type Authenticator interface {
	ClientID() string
	AccountID() string
	ClientSecret() string
	TokenURL() string
	EndpointURL() string
}

type BasePolicyServiceClient

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

func NewBasePolicyService

func NewBasePolicyService(clientID string, accountID string, clientSecret string, tokenURL string, endpointURL string) *BasePolicyServiceClient

func (*BasePolicyServiceClient) AccountID

func (me *BasePolicyServiceClient) AccountID() string

func (*BasePolicyServiceClient) CREATE

func (me *BasePolicyServiceClient) CREATE(ctx context.Context, level PolicyLevel, levelID string, policy *Policy) (string, error)

func (*BasePolicyServiceClient) ClientID

func (me *BasePolicyServiceClient) ClientID() string

func (*BasePolicyServiceClient) ClientSecret

func (me *BasePolicyServiceClient) ClientSecret() string

func (*BasePolicyServiceClient) DELETE

func (me *BasePolicyServiceClient) DELETE(ctx context.Context, level PolicyLevel, levelID string, uuid string) error

func (*BasePolicyServiceClient) EndpointURL added in v1.67.0

func (me *BasePolicyServiceClient) EndpointURL() string

func (*BasePolicyServiceClient) GET

func (me *BasePolicyServiceClient) GET(ctx context.Context, level PolicyLevel, levelID string, uuid string) (*Policy, error)

func (*BasePolicyServiceClient) LIST

func (me *BasePolicyServiceClient) LIST(ctx context.Context, level PolicyLevel, levelID string) ([]string, error)

func (*BasePolicyServiceClient) List

func (me *BasePolicyServiceClient) List(ctx context.Context, level PolicyLevel, levelID string) ([]PolicyStub, error)

func (*BasePolicyServiceClient) TokenURL added in v1.67.0

func (me *BasePolicyServiceClient) TokenURL() string

func (*BasePolicyServiceClient) UPDATE

func (me *BasePolicyServiceClient) UPDATE(ctx context.Context, level PolicyLevel, levelID string, policy *Policy, uuid string) error

type EnvironmentPolicyServiceClient

type EnvironmentPolicyServiceClient struct {
	PolicyClient *BasePolicyServiceClient
}

func NewEnvironmentPolicyService

func NewEnvironmentPolicyService(clientID string, accountID string, clientSecret string, tokenURL string, endpointURL string) *EnvironmentPolicyServiceClient

func (*EnvironmentPolicyServiceClient) CREATE

func (me *EnvironmentPolicyServiceClient) CREATE(ctx context.Context, policy *Policy) (string, error)

func (*EnvironmentPolicyServiceClient) DELETE

func (me *EnvironmentPolicyServiceClient) DELETE(ctx context.Context, level PolicyLevel, levelID string, uuid string) error

func (*EnvironmentPolicyServiceClient) GET

func (me *EnvironmentPolicyServiceClient) GET(ctx context.Context, levelID string, uuid string) (*Policy, error)

func (*EnvironmentPolicyServiceClient) LIST

func (me *EnvironmentPolicyServiceClient) LIST(ctx context.Context, level PolicyLevel, levelID string) ([]string, error)

func (*EnvironmentPolicyServiceClient) List

func (*EnvironmentPolicyServiceClient) UPDATE

func (me *EnvironmentPolicyServiceClient) UPDATE(ctx context.Context, policy *Policy, uuid string) error

type GlobalPolicyServiceClient

type GlobalPolicyServiceClient struct {
	PolicyClient *BasePolicyServiceClient
}

func NewGlobalPolicyService

func NewGlobalPolicyService(clientID string, accountID string, clientSecret string, tokenURL string, endpointURL string) *GlobalPolicyServiceClient

func (*GlobalPolicyServiceClient) DELETE

func (me *GlobalPolicyServiceClient) DELETE(ctx context.Context, level PolicyLevel, levelID string, uuid string) error

func (*GlobalPolicyServiceClient) GET

func (me *GlobalPolicyServiceClient) GET(ctx context.Context, levelID string, uuid string) (*Policy, error)

func (*GlobalPolicyServiceClient) LIST

func (me *GlobalPolicyServiceClient) LIST(ctx context.Context, level PolicyLevel, levelID string) ([]string, error)

func (*GlobalPolicyServiceClient) List

type IAMClient

type IAMClient interface {
	POST(ctx context.Context, url string, payload any, expectedResponseCode int, forceNewBearer bool) ([]byte, error)
	PUT(ctx context.Context, url string, payload any, expectedResponseCode int, forceNewBearer bool) ([]byte, error)
	GET(ctx context.Context, url string, expectedResponseCode int, forceNewBearer bool) ([]byte, error)
	DELETE(ctx context.Context, url string, expectedResponseCode int, forceNewBearer bool) ([]byte, error)
	DELETE_MULTI_RESPONSE(ctx context.Context, url string, expectedResponseCodes []int, forceNewBearer bool) ([]byte, error)
}

func NewIAMClient

func NewIAMClient(auth Authenticator) IAMClient

type IAMError

type IAMError struct {
	BError  bool   `json:"error"`
	Payload string `json:"payload"`
	Message string `json:"message"`
}

func (IAMError) Error

func (me IAMError) Error() string

type ListPoliciesResponse

type ListPoliciesResponse struct {
	Items []PolicyStub `json:"policies"`
}

type Policy

type Policy struct {
	// UUID           string   `json:"uuid,omitempty"`
	Name           string   `json:"name"`
	Tags           []string `json:"tags,omitempty"`
	Description    string   `json:"description,omitempty"`
	StatementQuery string   `json:"statementQuery"`
}

func (*Policy) MarshalHCL

func (me *Policy) MarshalHCL(properties hcl.Properties) error

func (*Policy) Schema

func (me *Policy) Schema() map[string]*schema.Schema

func (*Policy) UnmarshalHCL

func (me *Policy) UnmarshalHCL(decoder hcl.Decoder) error

type PolicyLevel

type PolicyLevel string

type PolicyStub

type PolicyStub struct {
	UUID        string `json:"uuid"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type RateLimiter added in v1.57.0

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

func NewRateLimiter added in v1.57.0

func NewRateLimiter() *RateLimiter

func (*RateLimiter) CanCall added in v1.57.0

func (rl *RateLimiter) CanCall() bool

Jump to

Keyboard shortcuts

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