provisioning

package
v1.1.100 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	APIKeyARD         = "api-key"
	BasicAuthARD      = "http-basic"
	APIKeyCRD         = "api-key"
	BasicAuthCRD      = "http-basic"
	OAuthSecretCRD    = "oauth-secret"
	OAuthPublicKeyCRD = "oauth-public-key"
	OAuthIDPCRD       = "oauth-idp"

	OauthClientID            = "clientId"
	OauthClientSecret        = "clientSecret"
	OauthPublicKey           = "publicKey"
	OauthGrantType           = "grantType"
	OauthTokenAuthMethod     = "tokenAuthMethod"
	OauthScopes              = "scopes"
	OauthRedirectURIs        = "redirectURLs"
	OauthJwksURI             = "jwksURI"
	OauthJwks                = "jwks"
	OauthCertificate         = "certificate"
	OauthCertificateMetadata = "certificateMetadata"
	OauthTLSAuthSANDNS       = "tlsClientAuthSanDNS"
	OauthTLSAuthSANEmail     = "tlsClientAuthSanEmail"
	OauthTLSAuthSANIP        = "tlsClientAuthSanIP"
	OauthTLSAuthSANURI       = "tlsClientAuthSanURI"
	OauthRegistrationToken   = "registration"

	IDPTokenURL = "idpTokenURL"

	APIKey = "apiKey"

	BasicAuthUsername = "username"
	BasicAuthPassword = "password"

	CredExpDetail = "Agent: CredentialExpired"
)

default names of ARD and CRDs

View Source
const (
	// Provision - state is waiting to provision
	Provision = iota + 1
	// Deprovision - state is waiting to deprovision
	Deprovision
)
View Source
const (
	DataTypeString  = "string"
	DataTypeNumber  = "number"
	DataTypeInteger = "integer"
	DataTypeArray   = "array"
	DataTypeObject  = "object"
)

Supported data types

Variables

This section is empty.

Functions

func NewStatusReason

func NewStatusReason(r RequestStatus) *v1.ResourceStatus

NewStatusReason converts a RequestStatus into a ResourceStatus

Types

type AccessData

type AccessData interface {
	GetData() map[string]interface{}
}

AccessData - holds the details about the access data to send to platform

type AccessDataBuilder

type AccessDataBuilder interface {
	SetData(data map[string]interface{}) AccessData
}

AccessDataBuilder - builder to create new access data to send to Central

func NewAccessDataBuilder

func NewAccessDataBuilder() AccessDataBuilder

NewAccessDataBuilder - create a access data builder

type AccessRequest

type AccessRequest interface {
	// GetApplicationDetailsValue returns a value found on the 'x-agent-details' sub resource of the ManagedApplications.
	GetApplicationDetailsValue(key string) string
	// GetApplicationName returns the name of the managed application for this credential
	GetApplicationName() string
	// GetID returns the ID of the resource for the request
	GetID() string
	// GetAccessRequestDetailsValue returns a value found on the 'x-agent-details' sub resource of the AccessRequest.
	GetAccessRequestDetailsValue(key string) string
	// GetAccessRequestData returns the map[string]interface{} of data from the request
	GetAccessRequestData() map[string]interface{}
	// GetAccessRequestProvisioningData returns the interface{} of data from the provisioning response
	GetAccessRequestProvisioningData() interface{}
	// GetInstanceDetails returns the 'x-agent-details' sub resource of the API Service Instance
	GetInstanceDetails() map[string]interface{}
	// GetQuota returns the quota from within the access request
	GetQuota() Quota
}

AccessRequest - interface for agents to use to get necessary access request details

type AccessRequestBuilder

type AccessRequestBuilder interface {
	SetName(name string) AccessRequestBuilder
	SetTitle(title string) AccessRequestBuilder
	SetRequestSchema(schema SchemaBuilder) AccessRequestBuilder
	SetProvisionSchema(schema SchemaBuilder) AccessRequestBuilder
	SetProvisionSchemaToRequestSchema() AccessRequestBuilder
	Register() (*management.AccessRequestDefinition, error)
}

AccessRequestBuilder - aids in creating a new access request

func NewAccessRequestBuilder

func NewAccessRequestBuilder(registerFunc RegisterAccessRequestDefinition) AccessRequestBuilder

NewAccessRequestBuilder - called by the agent package and sends in the function that registers this access request

type ApplicationRequest

type ApplicationRequest interface {
	// GetApplicationDetailsValue returns a value found on the 'x-agent-details' sub resource of the ManagedApplication
	GetApplicationDetailsValue(key string) string
	// GetManagedApplicationName returns the name of the managed application for this credential
	GetManagedApplicationName() string
	// GetTeamName gets the owning team name for the managed application
	GetTeamName() string
	// GetConsumerOrgID gets the ID of the owning consumer org for the managed application
	GetConsumerOrgID() string
	// GetID returns the ID of the resource for the request
	GetID() string
}

ApplicationRequest - interface for agents to use to get necessary application request details

type ArrayPropertyBuilder

type ArrayPropertyBuilder interface {
	// AddItem - Add an item property in the array property
	AddItem(item PropertyBuilder) ArrayPropertyBuilder
	// SetMinItems - Set the minimum number of items in the array property
	SetMinItems(min uint) ArrayPropertyBuilder
	// SetMaxItems - Set the maximum number of items in the array property
	SetMaxItems(max uint) ArrayPropertyBuilder
	PropertyBuilder
}

ArrayPropertyBuilder - specific methods related to the Array property builders

type Credential

type Credential interface {
	GetData() map[string]interface{}
	GetExpirationTime() time.Time
}

Credential - holds the details about the credential to send to encrypt and send to platform

type CredentialAction added in v1.1.35

type CredentialAction int

CredentialAction - the Action the agent needs to take for this CredentialUpdate request

const (
	// Enable - enable a credential
	Enable CredentialAction = iota + 1
	// Suspend - disable a credential
	Suspend
	// Rotate - create a new secret for a credential
	Rotate
	// Expire - mark the credential as expired
	Expire
)

func (CredentialAction) String added in v1.1.35

func (c CredentialAction) String() string

String returns the string value of the CredentialAction

type CredentialBuilder

type CredentialBuilder interface {
	SetExpirationTime(expTime time.Time) CredentialBuilder
	SetOAuthID(id string) Credential
	SetOAuthIDAndSecret(id, secret string) Credential
	SetAPIKey(key string) Credential
	SetHTTPBasic(username, password string) Credential
	SetCredential(data map[string]interface{}) Credential
}

CredentialBuilder - builder to create new credentials to send to Central

func NewCredentialBuilder

func NewCredentialBuilder() CredentialBuilder

NewCredentialBuilder - create a credential builder

type CredentialRequest

type CredentialRequest interface {
	// GetApplicationDetailsValue returns a value found on the 'x-agent-details' sub resource of the ManagedApplication.
	GetApplicationDetailsValue(key string) string
	// GetApplicationName returns the name of the managed application for this credential
	GetApplicationName() string
	// GetID returns the ID of the resource for the request
	GetID() string
	// GetName returns the name of the resource for the request
	GetName() string
	// GetCredentialDetailsValue returns a value found on the 'x-agent-details' sub resource of the Credential
	GetCredentialDetailsValue(key string) string
	// GetCredentialType returns the type of credential related to this request
	GetCredentialType() string
	// GetCredentialData returns the map[string]interface{} of data from the request
	GetCredentialData() map[string]interface{}
	// GetCredentialSchema returns the schema for the credential request.
	GetCredentialSchema() map[string]interface{}
	// GetCredentialProvisionSchema returns the provisioning schema for the credential request.
	GetCredentialProvisionSchema() map[string]interface{}
	// GetCredentialSchemaDetails returns a value found on the 'x-agent-details' sub resource of the crd.
	GetCredentialSchemaDetailsValue(key string) interface{}
	// IsIDPCredential returns boolean indicating if the credential request is for IDP provider
	IsIDPCredential() bool
	// GetIDPProvider returns the interface for IDP provider if the credential request is for IDP provider
	GetIDPProvider() o.Provider
	// GetIDPCredentialData returns the credential data for IDP from the request
	GetIDPCredentialData() IDPCredentialData
	// GetCredentialAction returns the action to be handled for this credential
	GetCredentialAction() CredentialAction
	// GetCredentialExpirationDays returns the number of days this credential has to live
	GetCredentialExpirationDays() int
}

CredentialRequest - interface for agents to use to get necessary credential request details

type CredentialRequestBuilder

type CredentialRequestBuilder interface {
	SetName(name string) CredentialRequestBuilder
	SetTitle(title string) CredentialRequestBuilder
	SetRequestSchema(schema SchemaBuilder) CredentialRequestBuilder
	SetProvisionSchema(schema SchemaBuilder) CredentialRequestBuilder
	SetWebhooks(webhooks []string) CredentialRequestBuilder
	AddWebhook(webhook string) CredentialRequestBuilder
	AddXAgentDetails(key string, value interface{}) CredentialRequestBuilder
	IsRenewable() CredentialRequestBuilder
	IsSuspendable() CredentialRequestBuilder
	SetExpirationDays(days int) CredentialRequestBuilder
	SetDeprovisionExpired() CredentialRequestBuilder
	Register() (*management.CredentialRequestDefinition, error)
}

CredentialRequestBuilder - aids in creating a new credential request

func NewCRDBuilder

NewCRDBuilder - called by the agent package and sends in the function that registers this credential request

type ExpiredCredentialAction added in v1.1.52

type ExpiredCredentialAction int

ExpiredCredentialAction - the action to take on an expired credential

const (
	// DeprovisionExpiredCredential - deprovision expired credentials
	DeprovisionExpiredCredential ExpiredCredentialAction = iota + 1
)

func ExpiredCredentialActionFromString added in v1.1.52

func ExpiredCredentialActionFromString(action string) ExpiredCredentialAction

String returns the string value of the RequestType enum

func (ExpiredCredentialAction) String added in v1.1.52

func (c ExpiredCredentialAction) String() string

String returns the string value of the RequestType enum

type IDPCredentialData

type IDPCredentialData interface {
	// GetClientID - returns client ID
	GetClientID() string
	// GetClientSecret - returns client secret
	GetClientSecret() string
	// GetScopes - returns client scopes
	GetScopes() []string
	// GetGrantTypes - returns grant types
	GetGrantTypes() []string
	// GetTokenEndpointAuthMethod - returns token auth method
	GetTokenEndpointAuthMethod() string
	// GetResponseTypes - returns token response type
	GetResponseTypes() []string
	// GetRedirectURIs - Returns redirect urls
	GetRedirectURIs() []string
	// GetJwksURI - returns JWKS uri
	GetJwksURI() string
	// GetPublicKey - returns the public key
	GetPublicKey() string
	// GetCertificate - returns the public certificate
	GetCertificate() string
	// GetCertificateMetadata - returns the certificate metadata property
	GetCertificateMetadata() string
	// GetTLSClientAuthSanDNS - returns the value for tls_client_auth_san_dns
	GetTLSClientAuthSanDNS() string
	// GetTLSClientAuthSanDNS - returns the value for tls_client_auth_san_dns
	GetTLSClientAuthSanEmail() string
	// GetTLSClientAuthSanIP - returns the value for tls_client_auth_san_ip
	GetTLSClientAuthSanIP() string
	// GetTLSClientAuthSanURI - returns the value for tls_client_auth_san_uri
	GetTLSClientAuthSanURI() string
}

IDPCredentialData - interface for the IDP credential request

type IntegerPropertyBuilder

type IntegerPropertyBuilder interface {
	// SetMinValue - Set the minimum allowed integer value
	SetMinValue(min int64) IntegerPropertyBuilder
	// SetMaxValue - Set the maximum allowed integer value
	SetMaxValue(min int64) IntegerPropertyBuilder
	// SetDefaultValue - Define the initial value for the property
	SetDefaultValue(value int64) IntegerPropertyBuilder
	PropertyBuilder
}

IntegerPropertyBuilder - specific methods related to the Integer property builders

type NumberPropertyBuilder

type NumberPropertyBuilder interface {
	// SetMinValue - Set the minimum allowed number value
	SetMinValue(min float64) NumberPropertyBuilder
	// SetMaxValue - Set the maximum allowed number value
	SetMaxValue(min float64) NumberPropertyBuilder
	// SetDefaultValue - Define the initial value for the property
	SetDefaultValue(value float64) NumberPropertyBuilder
	PropertyBuilder
}

NumberPropertyBuilder - specific methods related to the Number property builders

type ObjectPropertyBuilder

type ObjectPropertyBuilder interface {
	// AddProperty - Add a property in the object property
	AddProperty(property PropertyBuilder) ObjectPropertyBuilder
	PropertyBuilder
}

ObjectPropertyBuilder - specific methods related to the Object property builders

type PropertyBuilder

type PropertyBuilder interface {
	// Build - builds the property, this is called automatically by the schema builder
	Build() (*propertyDefinition, error)
	// BuildDependencies - builds the dependencies for the property, this is called automatically by the schema builder
	BuildDependencies() (*oneOfPropertyDefinitions, error)
}

PropertyBuilder - mandatory methods for all property builders

type PropertyDefinition added in v1.1.67

type PropertyDefinition interface {
	GetType() string
	GetArrayItems() []PropertyDefinition
	GetEnums() []string
}

type Provisioning

type Provisioning interface {
	AccessRequestDeprovision(AccessRequest) RequestStatus
	AccessRequestProvision(AccessRequest) (RequestStatus, AccessData)
	ApplicationRequestDeprovision(ApplicationRequest) RequestStatus
	ApplicationRequestProvision(ApplicationRequest) RequestStatus
	CredentialDeprovision(CredentialRequest) RequestStatus
	CredentialProvision(CredentialRequest) (RequestStatus, Credential)
	CredentialUpdate(CredentialRequest) (RequestStatus, Credential)
}

Provisioning - interface to be implemented by agents for access provisioning

type Quota

type Quota interface {
	// GetInterval returns the quota interval from within the access request
	GetInterval() QuotaInterval
	// GetIntervalString returns the string representation of the quota interval from within the access request
	GetIntervalString() string
	// GetLimit returns the quota limit from within the access request
	GetLimit() int64
	// GetPlanName returns the product plan name from within the access request
	GetPlanName() string
}

Quota - interface for accessing an access requests quota

func NewQuotaFromAccessRequest

func NewQuotaFromAccessRequest(ar *management.AccessRequest) Quota

NewQuotaFromAccessRequest create a Quota interface from an access request or nil if no quota on access request

type QuotaInterval

type QuotaInterval int

QuotaInterval is the quota limit

const (
	// Daily -
	Daily QuotaInterval = iota + 1
	// Weekly -
	Weekly
	// Monthly -
	Monthly
	// Annually -
	Annually
)

func (QuotaInterval) String

func (q QuotaInterval) String() string

String returns the string value of the State

type RegisterAccessRequestDefinition

type RegisterAccessRequestDefinition func(accessRequestDefinition *management.AccessRequestDefinition) (*management.AccessRequestDefinition, error)

RegisterAccessRequestDefinition - the function signature used when calling the NewAccessRequestBuilder function

type RegisterCredentialRequestDefinition

type RegisterCredentialRequestDefinition func(credentialRequestDefinition *management.CredentialRequestDefinition) (*management.CredentialRequestDefinition, error)

RegisterCredentialRequestDefinition - the function signature used when calling the NewCredentialRequestBuilder function

type RequestStatus

type RequestStatus interface {
	// GetReasons returns the Status reasons
	GetReasons() []v1.ResourceStatusReason
	// GetStatus returns the Status level
	GetStatus() Status
	// GetMessage returns the status message
	GetMessage() string
	// GetProperties returns additional details about a status.
	GetProperties() map[string]string
}

RequestStatus - holds info about the Status of the request

type RequestStatusBuilder

type RequestStatusBuilder interface {
	// Success - set the status as success
	Success() RequestStatus
	// Failed - set the status as failed
	Failed() RequestStatus
	// RequestStatusBuilder - adds any existing status reasons so they are not lost
	SetCurrentStatusReasons([]v1.ResourceStatusReason) RequestStatusBuilder
	// SetMessage - set the request Status message
	SetMessage(message string) RequestStatusBuilder
	// SetProperties - set the properties of the RequestStatus
	SetProperties(map[string]string) RequestStatusBuilder
	// AddProperty - add a new property on the RequestStatus
	AddProperty(key string, value string) RequestStatusBuilder
}

RequestStatusBuilder - builder to create new request Status

func NewRequestStatusBuilder

func NewRequestStatusBuilder() RequestStatusBuilder

NewRequestStatusBuilder - create a request Status builder

type RequestType

type RequestType int

RequestType - the type of credential request being sent

const (
	// RequestTypeProvision - provision new credentials
	RequestTypeProvision RequestType = iota + 1
	// RequestTypeRenew - renew existing credentials
	RequestTypeRenew
)

func (RequestType) String

func (c RequestType) String() string

String returns the string value of the RequestType enum

type SchemaBuilder

type SchemaBuilder interface {
	SetName(name string) SchemaBuilder
	SetDescription(description string) SchemaBuilder
	SetPropertyOrder(propertyOrder []string) SchemaBuilder
	AddProperty(property PropertyBuilder) SchemaBuilder
	AddUniqueKey(keyName string) SchemaBuilder
	// Build builds the json schema - this is called automatically by the resource builder
	Build() (map[string]interface{}, error)
}

SchemaBuilder - used to build a subscription schema for API Central

func NewSchemaBuilder

func NewSchemaBuilder() SchemaBuilder

NewSchemaBuilder - Creates a new subscription schema builder

type SchemaParser added in v1.1.67

type SchemaParser interface {
	Parse(schemaBytes []byte) (map[string]PropertyDefinition, error)
}

SchemaBuilder - used to build a subscription schema for API Central

func NewSchemaParser added in v1.1.67

func NewSchemaParser() SchemaParser

NewSchemaBuilder - Creates a new subscription schema builder

type State

type State int

State is the provisioning state

func (State) String

func (c State) String() string

String returns the string value of the State

type Status

type Status int

Status - the Status of the request

const (
	// Success - request was successful
	Success Status = iota + 1
	// Error - request failed
	Error
	// Pending - request is pending
	Pending
)

func (Status) String

func (c Status) String() string

String returns the string value of the Status

type StringPropertyBuilder

type StringPropertyBuilder interface {
	// SetEnumValues - Set a list of valid values for the property
	SetEnumValues(values []string) StringPropertyBuilder
	// SetSortEnumValues - Sort the allowed values alphabetically in the schema
	SetSortEnumValues() StringPropertyBuilder
	// SetFirstEnumValue - Set the value that should appear first in the list
	SetFirstEnumValue(value string) StringPropertyBuilder
	// AddEnumValue - Add another value to the list of allowed values for the property
	AddEnumValue(value string) StringPropertyBuilder
	// IsEncrypted - Set that this field must be encrypted at rest
	IsEncrypted() StringPropertyBuilder
	// IsCopyable - Set that this field may be copied via the UI
	IsCopyable() StringPropertyBuilder
	// SetDefaultValue - Define the initial value for the property
	SetDefaultValue(value string) StringPropertyBuilder
	// SetAsTextArea - Set value to be rendered as a textarea box within the UI
	SetAsTextArea() StringPropertyBuilder
	// AddDependency - Add property dependencies
	AddDependency(value string, property PropertyBuilder) StringPropertyBuilder
	PropertyBuilder
}

StringPropertyBuilder - specific methods related to the String property builders

type TypePropertyBuilder

type TypePropertyBuilder interface {
	// SetLabel - sets the label for the property
	SetLabel(label string) TypePropertyBuilder
	// SetName - sets the name of the property
	SetName(name string) TypePropertyBuilder
	// SetDescription - set the description of the property
	SetDescription(description string) TypePropertyBuilder
	// SetRequired - set the property as a required field in the schema
	SetRequired() TypePropertyBuilder
	// SetReadOnly - set the property as a read only property
	SetReadOnly() TypePropertyBuilder
	// SetHidden - set the property as a hidden property
	SetHidden() TypePropertyBuilder
	// IsString - Set the property to be of type string
	IsString() StringPropertyBuilder
	// IsInteger - Set the property to be of type integer
	IsInteger() IntegerPropertyBuilder
	// IsNumber - Set the property to be of type number
	IsNumber() NumberPropertyBuilder
	// IsArray - Set the property to be of type array
	IsArray() ArrayPropertyBuilder
	// IsObject - Set the property to be of type object
	IsObject() ObjectPropertyBuilder
	PropertyBuilder
}

TypePropertyBuilder - common methods related to type property builders

func NewSchemaPropertyBuilder

func NewSchemaPropertyBuilder() TypePropertyBuilder

NewSchemaPropertyBuilder - Creates a new subscription schema property builder

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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