avpTestSupport

package
v0.7.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const TestAwsAccessKeyId = "anAccessKeyID"
View Source
const TestAwsRegion = "us-west-1"
View Source
const TestAwsSecretAccessKey = "aSecretAccessKey"
View Source
const TestPolicyStoreArn = "arn:aws:verifiedpermissions::773752081234:policy-store/K21RFtXLb2qPRGA93DH7z5"
View Source
const TestPolicyStoreDescription = "Test Policy Store"
View Source
const TestResourceServerIdentifier = "https://some-resource-server"

Variables

View Source
var AvpApiUrl = fmt.Sprintf("https://verifiedpermissions.%s.amazonaws.com/", TestAwsRegion)
View Source
var TestCedarStaticPolicy = `` /* 169-byte string literal not displayed */
View Source
var TestCedarStaticPolicyDescription = "Simple static policy"
View Source
var TestCedarStaticPolicyId = "id1"
View Source
var TestCedarTemplateId = "temp1"
View Source
var TestCedarTemplatePolicy = `
permit(
    principal == ?principal,
    action in [hexa_avp::Action::"ReadAccount"],
    resource == ?resource
);`
View Source
var TestCedarTemplatePolicyId = "id2"
View Source
var TestPolicyStoreId = "K21RFtXLb2qPRGA93DH7z5"

Functions

func AwsCredentialsForTest

func AwsCredentialsForTest() []byte

func CreatePolicyResponse

func CreatePolicyResponse(id string) []byte

func GetPolicyResponse

func GetPolicyResponse(id string) []byte

func GetPolicyTemplateResponse

func GetPolicyTemplateResponse(id string) []byte

func IntegrationInfo

func IntegrationInfo() policyprovider.IntegrationInfo

func ListPoliciesResponse

func ListPoliciesResponse(staticPolCnt int, templatePolCnt int, nextToken *string) []byte

func ListStoresResponse

func ListStoresResponse() []byte

Types

type EntityIdentifier

type EntityIdentifier struct {

	// The identifier of an entity.
	//
	// "entityId":"identifier"
	//
	// EntityId is a sensitive parameter and its value will be
	// replaced with "sensitive" in string returned by EntityIdentifier's
	// String and GoString methods.
	//
	// EntityId is a required field
	EntityId *string `json:"entityId" locationName:"entityId" min:"1" type:"string" required:"true" sensitive:"true"`

	// The type of an entity.
	//
	// Example: "entityType":"typeName"
	//
	// EntityType is a sensitive parameter and its value will be
	// replaced with "sensitive" in string returned by EntityIdentifier's
	// String and GoString methods.
	//
	// EntityType is a required field
	EntityType *string `json:"entityType" locationName:"entityType" min:"1" type:"string" required:"true" sensitive:"true"`
}

type GetPolicyTemplateOutput

type GetPolicyTemplateOutput struct {

	// The date and time that the policy template was originally created.
	//
	// CreatedDate is a required field
	CreatedDate *time.Time `json:"createdDate" locationName:"createdDate" type:"timestamp" timestampFormat:"iso8601" required:"true"`

	// The description of the policy template.
	//
	// Description is a sensitive parameter and its value will be
	// replaced with "sensitive" in string returned by GetPolicyTemplateOutput's
	// String and GoString methods.
	Description *string `json:"description" locationName:"description" type:"string" sensitive:"true"`

	// The date and time that the policy template was most recently updated.
	//
	// LastUpdatedDate is a required field
	LastUpdatedDate *time.Time `json:"lastUpdatedDate" locationName:"lastUpdatedDate" type:"timestamp" timestampFormat:"iso8601" required:"true"`

	// The ID of the policy store that contains the policy template.
	//
	// PolicyStoreId is a required field
	PolicyStoreId *string `json:"policyStoreId" locationName:"policyStoreId" min:"1" type:"string" required:"true"`

	// The ID of the policy template.
	//
	// PolicyTemplateId is a required field
	PolicyTemplateId *string `json:"policyTemplateId" locationName:"policyTemplateId" min:"1" type:"string" required:"true"`

	// The content of the body of the policy template written in the Cedar policy
	// language.
	//
	// Statement is a sensitive parameter and its value will be
	// replaced with "sensitive" in string returned by GetPolicyTemplateOutput's
	// String and GoString methods.
	//
	// Statement is a required field
	Statement *string `json:"statement" locationName:"statement" min:"1" type:"string" required:"true" sensitive:"true"`
}

type MockListPoliciesOutput

type MockListPoliciesOutput struct {
	Policies  []PolicyItem `json:"policies"`
	NextToken *string      `json:"nextToken"`
}

type MockPolicyStoreItem

type MockPolicyStoreItem struct {
	Arn             *string    `json:"arn"`
	PolicyStoreId   *string    `json:"policyStoreId"`
	CreatedDate     *time.Time `json:"createdDate"`
	LastUpdatedDate *time.Time `json:"lastUpdatedDate"`
	Description     *string    `json:"description"`
}

type MockPolicyStoresOutput

type MockPolicyStoresOutput struct {
	// The parser in AWS verified permissions client is looking for "policyStores"
	PolicyStores []MockPolicyStoreItem `json:"policyStores"`
	NextToken    *string               `json:"nextToken"`
}

type MockVerifiedPermissionsHTTPClient

type MockVerifiedPermissionsHTTPClient struct {
	mock.Mock
	// contains filtered or unexported fields
}

func NewMockVerifiedPermissionsHTTPClient

func NewMockVerifiedPermissionsHTTPClient() *MockVerifiedPermissionsHTTPClient

func (*MockVerifiedPermissionsHTTPClient) AddRequest

func (m *MockVerifiedPermissionsHTTPClient) AddRequest(method, url, apiOp string, statusCode int, responseBody []byte)

func (*MockVerifiedPermissionsHTTPClient) Do

func (*MockVerifiedPermissionsHTTPClient) Get

func (m *MockVerifiedPermissionsHTTPClient) Get(url string) (resp *http.Response, err error)

func (*MockVerifiedPermissionsHTTPClient) GetRequestBody

func (m *MockVerifiedPermissionsHTTPClient) GetRequestBody(method, url, serviceOp string) []byte

func (*MockVerifiedPermissionsHTTPClient) GetRequestBodyByIndex

func (m *MockVerifiedPermissionsHTTPClient) GetRequestBodyByIndex(method, url, serviceOp string, reqIndex int) []byte

func (*MockVerifiedPermissionsHTTPClient) MockCreatePolicyWithHttpStatus

func (m *MockVerifiedPermissionsHTTPClient) MockCreatePolicyWithHttpStatus(httpStatus int, id string)

func (*MockVerifiedPermissionsHTTPClient) MockDeletePolicyWithHttpStatus

func (m *MockVerifiedPermissionsHTTPClient) MockDeletePolicyWithHttpStatus(httpStatus int)

func (*MockVerifiedPermissionsHTTPClient) MockGetPolicyTemplateWithHttpStatus

func (m *MockVerifiedPermissionsHTTPClient) MockGetPolicyTemplateWithHttpStatus(httpStatus int, id string)

func (*MockVerifiedPermissionsHTTPClient) MockGetPolicyWithHttpStatus

func (m *MockVerifiedPermissionsHTTPClient) MockGetPolicyWithHttpStatus(httpStatus int, id string)

func (*MockVerifiedPermissionsHTTPClient) MockListPolicies

func (m *MockVerifiedPermissionsHTTPClient) MockListPolicies()

func (*MockVerifiedPermissionsHTTPClient) MockListPoliciesWithHttpStatus

func (m *MockVerifiedPermissionsHTTPClient) MockListPoliciesWithHttpStatus(httpStatus int, staticPolCnt int, templatePolCnt int, nextToken *string)

func (*MockVerifiedPermissionsHTTPClient) MockListStores

func (m *MockVerifiedPermissionsHTTPClient) MockListStores()

func (*MockVerifiedPermissionsHTTPClient) MockListStoresWithHttpStatus

func (m *MockVerifiedPermissionsHTTPClient) MockListStoresWithHttpStatus(httpStatus int)

func (*MockVerifiedPermissionsHTTPClient) MockUpdatePolicyWithHttpStatus

func (m *MockVerifiedPermissionsHTTPClient) MockUpdatePolicyWithHttpStatus(httpStatus int, id string)

func (*MockVerifiedPermissionsHTTPClient) Post

func (m *MockVerifiedPermissionsHTTPClient) Post(url, _ string, body io.Reader) (resp *http.Response, err error)

func (*MockVerifiedPermissionsHTTPClient) VerifyCalled

func (m *MockVerifiedPermissionsHTTPClient) VerifyCalled() bool

type PolicyDefinitionItem

type PolicyDefinitionItem struct {

	// Information about a static policy that wasn't created with a policy template.
	Static *StaticPolicyDefinitionItem `json:"static" locationName:"static" type:"structure"`

	// Information about a template-linked policy that was created by instantiating
	// a policy template.
	TemplateLinked *TemplateLinkedPolicyDefinitionItem `json:"templateLinked" locationName:"templateLinked" type:"structure"`
}

type PolicyItem

type PolicyItem struct {
	// The date and time the policy was created.
	//
	// CreatedDate is a required field
	CreatedDate *time.Time `json:"createdDate" locationName:"createdDate" type:"timestamp" timestampFormat:"iso8601" required:"true"`

	// The policy definition of an item in the list of policies returned.
	//
	// Definition is a required field
	Definition *PolicyDefinitionItem `json:"definition" locationName:"definition" type:"structure" required:"true"`

	// The date and time the policy was most recently updated.
	//
	// LastUpdatedDate is a required field
	LastUpdatedDate *time.Time `json:"lastUpdatedDate" locationName:"lastUpdatedDate" type:"timestamp" timestampFormat:"iso8601" required:"true"`

	// The identifier of the policy you want information about.
	//
	// PolicyId is a required field
	PolicyId *string `json:"policyId" locationName:"policyId" min:"1" type:"string" required:"true"`

	// The identifier of the PolicyStore where the policy you want information about
	// is stored.
	//
	// PolicyStoreId is a required field
	PolicyStoreId *string `json:"policyStoreId" locationName:"policyStoreId" min:"1" type:"string" required:"true"`

	// The type of the policy. This is one of the following values:
	//
	//    * static
	//
	//    * templateLinked
	//
	// PolicyType is a required field
	PolicyType *string `json:"policyType" locationName:"policyType" type:"string" required:"true" enum:"PolicyType"`

	// The principal associated with the policy.
	Principal *EntityIdentifier `json:"principal" locationName:"principal" type:"structure"`

	// The resource associated with the policy.
	Resource *EntityIdentifier `json:"resource" locationName:"resource" type:"structure"`
}

func GenerateStaticPolicyItem

func GenerateStaticPolicyItem(isDetail bool, id string) PolicyItem

func GenerateTemplatePolicyItem

func GenerateTemplatePolicyItem(id string) PolicyItem

type PolicyOutput

type PolicyOutput struct {

	// The date and time the policy was originally created.
	//
	// CreatedDate is a required field
	CreatedDate *time.Time `json:"createdDate" locationName:"createdDate" type:"timestamp" timestampFormat:"iso8601" required:"true"`

	// The date and time the policy was last updated.
	//
	// LastUpdatedDate is a required field
	LastUpdatedDate *time.Time `json:"lastUpdatedDate" locationName:"lastUpdatedDate" type:"timestamp" timestampFormat:"iso8601" required:"true"`

	// The unique ID of the new policy.
	//
	// PolicyId is a required field
	PolicyId *string `json:"policyId" locationName:"policyId" min:"1" type:"string" required:"true"`

	// The ID of the policy store that contains the new policy.
	//
	// PolicyStoreId is a required field
	PolicyStoreId *string `json:"policyStoreId" locationName:"policyStoreId" min:"1" type:"string" required:"true"`

	// The policy type of the new policy.
	//
	// PolicyType is a required field
	PolicyType *string `json:"policyType" locationName:"policyType" type:"string" required:"true" enum:"PolicyType"`

	// The principal specified in the new policy's scope. This response element
	// isn't present when principal isn't specified in the policy content.
	Principal *EntityIdentifier `json:"principal" locationName:"principal" type:"structure"`

	// The resource specified in the new policy's scope. This response element isn't
	// present when the resource isn't specified in the policy content.
	Resource *EntityIdentifier `json:"resource" locationName:"resource" type:"structure"`
}

type StaticPolicyDefinitionItem

type StaticPolicyDefinitionItem struct {

	// A description of the static policy.
	//
	// Description is a sensitive parameter and its value will be
	// replaced with "sensitive" in string returned by StaticPolicyDefinitionItem's
	// String and GoString methods.
	Description *string `json:"description" locationName:"description" type:"string" sensitive:"true"`

	// Statement is a required field
	Statement *string `json:"statement" locationName:"statement" min:"1" type:"string" required:"true" sensitive:"true"`
}

type TemplateLinkedPolicyDefinitionItem

type TemplateLinkedPolicyDefinitionItem struct {

	// The unique identifier of the policy template used to create this policy.
	//
	// PolicyTemplateId is a required field
	PolicyTemplateId *string `json:"policyTemplateId" locationName:"policyTemplateId" min:"1" type:"string" required:"true"`

	// The principal associated with this template-linked policy. Verified Permissions
	// substitutes this principal for the ?principal placeholder in the policy template
	// when it evaluates an authorization request.
	Principal *EntityIdentifier `json:"principal" locationName:"principal" type:"structure"`

	// The resource associated with this template-linked policy. Verified Permissions
	// substitutes this resource for the ?resource placeholder in the policy template
	// when it evaluates an authorization request.
	Resource *EntityIdentifier `json:"resource" locationName:"resource" type:"structure"`
}

Jump to

Keyboard shortcuts

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