handlers

package
v0.33.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 37 Imported by: 0

Documentation

Overview

Package handlers is a generated GoMock package.

Index

Constants

View Source
const (
	// AzureFederatedIdentityAudience represents the Azure AD OIDC target audience.
	AzureFederatedIdentityAudience = "api://AzureADTokenExchange"

	// FederatedIdentityNameKey is the key to represent the federated identity credential name (aka workload identity).
	FederatedIdentityNameKey = "federatedidentityname"
	// FederatedIdentityIssuerKey is the key to represent the oidc issuer.
	FederatedIdentityIssuerKey = "federatedidentityissuer"
	// FederatedIdentitySubjectKey is the key to represent the identity subject.
	FederatedIdentitySubjectKey = "federatedidentitysubject"
)
View Source
const (
	RoleNameKey = "rolename"

	// RoleAssignmentScope is used to pass the fully qualified identifier of the resource for which the role assignment needs to be created
	RoleAssignmentScope = "roleassignmentscope"
)
View Source
const (
	IdentityProperties                 = "identityproperties"
	UserAssignedIdentityNameKey        = "userassignedidentityname"
	UserAssignedIdentityIDKey          = "userassignedidentityid"
	UserAssignedIdentityPrincipalIDKey = "userassignedidentityprincipalid"
	UserAssignedIdentityClientIDKey    = "userassignedidentityclientid"
	UserAssignedIdentityTenantIDKey    = "userassignedidentitytenantid"
	UserAssignedIdentitySubscriptionID = "userassignedidentitysubscriptionid"
	UserAssignedIdentityResourceGroup  = "userassignedidentityresourcegroup"
)
View Source
const (
	MaxHTTPProxyDeploymentTimeout = time.Minute * time.Duration(10)
	HTTPProxyConditionValid       = "Valid"
	HTTPProxyStatusInvalid        = "invalid"
	HTTPProxyStatusValid          = "valid"
)
View Source
const (
	// Common K8s Keys
	KubernetesAPIVersionKey = "kubernetesapiversion"
	KubernetesKindKey       = "kuberneteskind"
	KubernetesNamespaceKey  = "kubernetesnamespace"
	KubernetesNameKey       = "kubernetesname"
	ResourceName            = "resourcename"
)
View Source
const (
	// Common Keys
	APIVersionKey   = "kubernetesapiversion"
	KindKey         = "kuberneteskind"
	NamespaceKey    = "kubernetesnamespace"
	NameKey         = "kubernetesname"
	ResourceNameKey = "resourcename"
)
View Source
const (
	// DefaultCacheResyncInterval is the interval for resyncing informer.
	DefaultCacheResyncInterval = time.Second * time.Duration(30)
)
View Source
const (
	// MaxDeploymentTimeout is the max timeout for waiting for a deployment to be ready.
	// Deployment duration should not reach to this timeout since async operation worker will time out context before MaxDeploymentTimeout.
	MaxDeploymentTimeout = time.Minute * time.Duration(10)
)

Variables

This section is empty.

Functions

func GetKubeAzureSubject

func GetKubeAzureSubject(namespace, saName string) string

GetKubeAzureSubject constructs the federated identity subject in the format "system:serviceaccount:<namespace>:<saName>" from the given namespace and service account name.

func GetMapValue

func GetMapValue[T any](collection any, key string) (T, error)

GetMapValue returns the value of a given key from a map of strings or a map of any type, or an error if the key is not found or the value is not of the expected type.

func NewDeploymentWaiter

func NewDeploymentWaiter(clientSet k8s.Interface) *deploymentWaiter

func NewHTTPProxyWaiter

func NewHTTPProxyWaiter(dynamicClientSet dynamic.Interface) *httpProxyWaiter

NewHTTPProxyWaiter returns a new instance of HTTPProxyWaiter

func ValidateResourceIDsForResource

func ValidateResourceIDsForResource(properties map[string]string, keys ...string) error

ValidateResourceIDsForResource checks if the given properties map contains all the required keys and returns an error if

any of the keys are missing.

Types

type DeleteOptions

type DeleteOptions struct {
	// Resource represents the rendered resource.
	Resource *rpv1.OutputResource
}

DeleteOptions represents the options for ResourceHandler.Delete.

type MockResourceHandler

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

MockResourceHandler is a mock of ResourceHandler interface.

func NewMockResourceHandler

func NewMockResourceHandler(ctrl *gomock.Controller) *MockResourceHandler

NewMockResourceHandler creates a new mock instance.

func (*MockResourceHandler) Delete

func (m *MockResourceHandler) Delete(arg0 context.Context, arg1 *DeleteOptions) error

Delete mocks base method.

func (*MockResourceHandler) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockResourceHandler) Put

func (m *MockResourceHandler) Put(arg0 context.Context, arg1 *PutOptions) (map[string]string, error)

Put mocks base method.

type MockResourceHandlerMockRecorder

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

MockResourceHandlerMockRecorder is the mock recorder for MockResourceHandler.

func (*MockResourceHandlerMockRecorder) Delete

func (mr *MockResourceHandlerMockRecorder) Delete(arg0, arg1 interface{}) *gomock.Call

Delete indicates an expected call of Delete.

func (*MockResourceHandlerMockRecorder) Put

func (mr *MockResourceHandlerMockRecorder) Put(arg0, arg1 interface{}) *gomock.Call

Put indicates an expected call of Put.

type PutOptions

type PutOptions struct {
	// Resource represents the rendered resource.
	Resource *rpv1.OutputResource

	// DependencyProperties is a map of output resource localID to resource properties populated during deployment in the resource handler
	DependencyProperties map[string]map[string]string
}

PutOptions represents the options for ResourceHandler.Put.

type ResourceHandler

type ResourceHandler interface {
	// Put deploys the rendered output resource and returns and populates the properties during deployment,
	// which can be used by the next resource handlers.
	Put(ctx context.Context, options *PutOptions) (map[string]string, error)

	// Delete deletes the rendered output resource.
	Delete(ctx context.Context, options *DeleteOptions) error
}

ResourceHandler interface defines the methods that every output resource will implement

func NewARMHandler

func NewARMHandler(arm *armauth.ArmConfig) ResourceHandler

NewARMHandler creates a new ARMHandler instance with the given ARM configuration, for 'generic' ARM resources.

func NewAzureFederatedIdentity

func NewAzureFederatedIdentity(arm *armauth.ArmConfig) ResourceHandler

NewAzureFederatedIdentity creates a new instance of AzureFederatedIdentityHandler.

func NewAzureRoleAssignmentHandler

func NewAzureRoleAssignmentHandler(arm *armauth.ArmConfig) ResourceHandler

NewAzureRoleAssignmentHandler creates a new instance of azureRoleAssignmentHandler which is used to handle Azure role assignments.

func NewAzureUserAssignedManagedIdentityHandler

func NewAzureUserAssignedManagedIdentityHandler(arm *armauth.ArmConfig) ResourceHandler

NewAzureUserAssignedManagedIdentityHandler creates a new ResourceHandler for Azure User Assigned Managed Identity.

func NewKubernetesHandler

func NewKubernetesHandler(client client.Client, clientSet k8s.Interface, discoveryClient discovery.ServerResourcesInterface, dynamicClientSet dynamic.Interface) ResourceHandler

NewKubernetesHandler creates a new KubernetesHandler which is used to handle Kubernetes resources.

type ResourceWaiter

type ResourceWaiter interface {
	// contains filtered or unexported methods
}

Create an interface for deployment waiter and http proxy waiter

Jump to

Keyboard shortcuts

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