iam

package
v1.64.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2024 License: Apache-2.0 Imports: 16 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, 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) *AccountPolicyServiceClient

func (*AccountPolicyServiceClient) CREATE

func (me *AccountPolicyServiceClient) CREATE(policy *Policy) (string, error)

func (*AccountPolicyServiceClient) DELETE

func (me *AccountPolicyServiceClient) DELETE(level PolicyLevel, levelID string, uuid string) error

func (*AccountPolicyServiceClient) GET

func (me *AccountPolicyServiceClient) GET(levelID string, uuid string) (*Policy, error)

func (*AccountPolicyServiceClient) LIST

func (me *AccountPolicyServiceClient) LIST(level PolicyLevel, levelID string) ([]string, error)

func (*AccountPolicyServiceClient) List

func (*AccountPolicyServiceClient) UPDATE

func (me *AccountPolicyServiceClient) UPDATE(policy *Policy, uuid string) error

type Authenticator

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

type BasePolicyServiceClient

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

func NewBasePolicyService

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

func (*BasePolicyServiceClient) AccountID

func (me *BasePolicyServiceClient) AccountID() string

func (*BasePolicyServiceClient) CREATE

func (me *BasePolicyServiceClient) CREATE(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(level PolicyLevel, levelID string, uuid string) error

func (*BasePolicyServiceClient) GET

func (me *BasePolicyServiceClient) GET(level PolicyLevel, levelID string, uuid string) (*Policy, error)

func (*BasePolicyServiceClient) LIST

func (me *BasePolicyServiceClient) LIST(level PolicyLevel, levelID string) ([]string, error)

func (*BasePolicyServiceClient) List

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

func (*BasePolicyServiceClient) UPDATE

func (me *BasePolicyServiceClient) UPDATE(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) *EnvironmentPolicyServiceClient

func (*EnvironmentPolicyServiceClient) CREATE

func (me *EnvironmentPolicyServiceClient) CREATE(policy *Policy) (string, error)

func (*EnvironmentPolicyServiceClient) DELETE

func (me *EnvironmentPolicyServiceClient) DELETE(level PolicyLevel, levelID string, uuid string) error

func (*EnvironmentPolicyServiceClient) GET

func (me *EnvironmentPolicyServiceClient) GET(levelID string, uuid string) (*Policy, error)

func (*EnvironmentPolicyServiceClient) LIST

func (me *EnvironmentPolicyServiceClient) LIST(level PolicyLevel, levelID string) ([]string, error)

func (*EnvironmentPolicyServiceClient) List

func (*EnvironmentPolicyServiceClient) UPDATE

func (me *EnvironmentPolicyServiceClient) UPDATE(policy *Policy, uuid string) error

type GlobalPolicyServiceClient

type GlobalPolicyServiceClient struct {
	PolicyClient *BasePolicyServiceClient
}

func NewGlobalPolicyService

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

func (*GlobalPolicyServiceClient) DELETE

func (me *GlobalPolicyServiceClient) DELETE(level PolicyLevel, levelID string, uuid string) error

func (*GlobalPolicyServiceClient) GET

func (me *GlobalPolicyServiceClient) GET(levelID string, uuid string) (*Policy, error)

func (*GlobalPolicyServiceClient) LIST

func (me *GlobalPolicyServiceClient) LIST(level PolicyLevel, levelID string) ([]string, error)

func (*GlobalPolicyServiceClient) List

func (me *GlobalPolicyServiceClient) List() ([]PolicyStub, error)

type IAMClient

type IAMClient interface {
	POST(url string, payload any, expectedResponseCode int, forceNewBearer bool) ([]byte, error)
	PUT(url string, payload any, expectedResponseCode int, forceNewBearer bool) ([]byte, error)
	GET(url string, expectedResponseCode int, forceNewBearer bool) ([]byte, error)
	DELETE(url string, expectedResponseCode int, forceNewBearer bool) ([]byte, error)
	DELETE_MULTI_RESPONSE(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