Documentation ¶
Index ¶
- func CheckPolicyExists(auth iam.Authenticator, levelType string, levelID string, policyUUID string) (bool, string, error)
- func FetchAllPolicyLevels(auth iam.Authenticator) (map[string]PolicyLevel, error)
- func FetchPolicyLevel(auth iam.Authenticator, uuid string) (levelType string, levelID string, name string, err error)
- func GetEnvironmentIDs(auth iam.Authenticator) ([]string, error)
- func IsValidUUID(uuid string) bool
- func Join(uuid string, levelType string, levelID string) string
- func RegisterPolicyLevel(auth iam.Authenticator, level PolicyLevel) error
- func ResolvePolicyLevel(auth iam.Authenticator, uuid string) (levelType string, levelID string, name string, err error)
- func Service(credentials *settings.Credentials) settings.CRUDService[*policies.Policy]
- func SplitID(id string, defLevelType string, defLevelID string) (uuid string, levelType string, levelID string, err error)
- func SplitIDNoDefaults(id string) (uuid string, levelType string, levelID string, err error)
- func UNUSED_PARAMETER(v any)
- type DataStub
- type ListEnvResponse
- type ListPoliciesResponse
- type PolicyCreateResponse
- type PolicyLevel
- type PolicyServiceClient
- func (me *PolicyServiceClient) AccountID() string
- func (me *PolicyServiceClient) ClientID() string
- func (me *PolicyServiceClient) ClientSecret() string
- func (me *PolicyServiceClient) Create(ctx context.Context, v *policies.Policy) (*api.Stub, error)
- func (me *PolicyServiceClient) Delete(ctx context.Context, id string) error
- func (me *PolicyServiceClient) Get(ctx context.Context, id string, v *policies.Policy) error
- func (me *PolicyServiceClient) List(ctx context.Context) (api.Stubs, error)
- func (me *PolicyServiceClient) ListWithGlobals() (api.Stubs, error)
- func (me *PolicyServiceClient) Name() string
- func (me *PolicyServiceClient) SchemaID() string
- func (me *PolicyServiceClient) Update(ctx context.Context, id string, user *policies.Policy) error
- type PolicyStub
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPolicyExists ¶ added in v1.57.0
func CheckPolicyExists(auth iam.Authenticator, levelType string, levelID string, policyUUID string) (bool, string, error)
CheckPolicyExists attempts to fetch the details of a policy, identified by the given `policyUUID` and the presumed `levelType` and `levelID`. If the policy is not defined at the given `levelType` and `levelID` it returns false, without returning an error An error is returned ONLY if querying for the existence of the policy failed for another reason than `404 Not Found`
func FetchAllPolicyLevels ¶ added in v1.57.0
func FetchAllPolicyLevels(auth iam.Authenticator) (map[string]PolicyLevel, error)
FetchAllPolicyLevels pulls all known polices reachable via the given IAM Client from the REST API and notes down the `levelType` and `levelID` for these polices (identified via a UUID only).
You should use `ResolvePolicyLevel` to look up the `levelType` and `levelID` of a policy identifed by a UUID only ¶
This operation is guarded by a mutext
func FetchPolicyLevel ¶ added in v1.57.0
func FetchPolicyLevel(auth iam.Authenticator, uuid string) (levelType string, levelID string, name string, err error)
FetchPolicyLevel determines the `levelType` and `levelID` of a policy identified by its UUID by trial and error, i.e. requests the policy from the REST API using all known combinations
Option 1: The policy is a global policy (levelType = global, levelID = global) Option 2: The policy is on the account level, identified by the argument `accountID` (levelType = account, levelID = `accountID` argument) Option 3: The policy is on the environment level. ALL environments reachable via the account are being taken into consideration
If all attempts fail the returned error contains the UUID in its message ¶
This operation is guarded by a mutex
func GetEnvironmentIDs ¶ added in v1.57.0
func GetEnvironmentIDs(auth iam.Authenticator) ([]string, error)
GetEnvironmentIDs retrieves all environmentIDs reachable via the given accountID The operation is guarded by a mutex
func IsValidUUID ¶ added in v1.57.0
func RegisterPolicyLevel ¶ added in v1.57.0
func RegisterPolicyLevel(auth iam.Authenticator, level PolicyLevel) error
RegisterPolicyLevel notes down the `levelType` and `levelID` of the policy identified by the given `uuid`. Prior to that, if it hasn't happened yet, all known polices are getting pulled from the REST API In other words: Registering the `levelType` and `levelID` avoids that just partial information about the policys is stored locally. It's all nor nothing.
An error will be returned in case loading all known polices from the REST API fails for some reason ¶
This operation is guarded by a mutex.
func ResolvePolicyLevel ¶ added in v1.57.0
func ResolvePolicyLevel(auth iam.Authenticator, uuid string) (levelType string, levelID string, name string, err error)
ResolvePolicyLevel determines the `levelType` and `levelID` of a policy using different strategies
- If it hasn't happened yet, all known policies are getting retrieved from the REST API
- In case none of the results contains the given `policyUUID` the `levelType` and `levelID` are getting resolved using trial and error (see `fetchPolicyLevel`)
This operation is guarded by a mutex
func Service ¶
func Service(credentials *settings.Credentials) settings.CRUDService[*policies.Policy]
func SplitID ¶
func SplitID(id string, defLevelType string, defLevelID string) (uuid string, levelType string, levelID string, err error)
defLevelType and devLevelID are getting used in case the passed policyID is just its UUID
In such a case the caller needs to have access to other configuration with these two strings e.g. the config object the policyIDs are embedded in
func SplitIDNoDefaults ¶ added in v1.57.0
func UNUSED_PARAMETER ¶ added in v1.59.0
func UNUSED_PARAMETER(v any)
Types ¶
type ListEnvResponse ¶ added in v1.48.0
type ListEnvResponse struct {
Data []DataStub `json:"data"`
}
type ListPoliciesResponse ¶ added in v1.48.0
type ListPoliciesResponse struct {
Policies []PolicyStub `json:"policies"`
}
type PolicyCreateResponse ¶
type PolicyCreateResponse struct {
UUID string `json:"uuid"`
}
type PolicyLevel ¶ added in v1.57.0
type PolicyServiceClient ¶
type PolicyServiceClient struct {
// contains filtered or unexported fields
}
func NewPolicyService ¶
func NewPolicyService(clientID string, accountID string, clientSecret string) *PolicyServiceClient
func ServiceWithGloabals ¶ added in v1.57.0
func ServiceWithGloabals(credentials *settings.Credentials) *PolicyServiceClient
func (*PolicyServiceClient) AccountID ¶
func (me *PolicyServiceClient) AccountID() string
func (*PolicyServiceClient) ClientID ¶
func (me *PolicyServiceClient) ClientID() string
func (*PolicyServiceClient) ClientSecret ¶
func (me *PolicyServiceClient) ClientSecret() string
func (*PolicyServiceClient) Delete ¶
func (me *PolicyServiceClient) Delete(ctx context.Context, id string) error
func (*PolicyServiceClient) ListWithGlobals ¶ added in v1.57.0
func (me *PolicyServiceClient) ListWithGlobals() (api.Stubs, error)
func (*PolicyServiceClient) Name ¶ added in v1.28.0
func (me *PolicyServiceClient) Name() string
func (*PolicyServiceClient) SchemaID ¶
func (me *PolicyServiceClient) SchemaID() string