credential

package
v0.39.0 Latest Latest
Warning

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

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

Documentation

Overview

Package credential is a generated GoMock package.

Package credential is a generated GoMock package.

Package credential is a generated GoMock package.

Index

Constants

View Source
const (
	AWSCredential = "aws"
	AWSPlaneName  = "aws"

	ValidInfoTemplate = "enter valid info for %s"
)
View Source
const (
	AzurePlaneType  = "azure"
	AWSPlaneType    = "aws"
	AzureCredential = "azure"
	AzurePlaneName  = "azurecloud"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AWSAccessKeyCredentialProperties added in v0.37.0

type AWSAccessKeyCredentialProperties struct {
	// Kind is the credential kind (Must be AccessKey)
	Kind *string

	// AccessKeyID is the AWS access key ID
	AccessKeyID *string
}

type AWSCredentialManagementClient

type AWSCredentialManagementClient struct {
	AWSCredentialClient ucp.AwsCredentialsClient
}

AWSCredentialManagementClient is used to interface with cloud provider configuration and credentials.

func (*AWSCredentialManagementClient) Delete

func (cpm *AWSCredentialManagementClient) Delete(ctx context.Context, name string) (bool, error)

Delete checks if a credential for the provider plane is registered and if so, deletes it; if not, it returns true without an error. If an error occurs, it returns false and the error.

func (*AWSCredentialManagementClient) Get

"Get" retrieves the credentials for the specified cloud provider from the backend and returns a ProviderCredentialConfiguration object containing the credentials or an error if the credentials could not be retrieved.

func (*AWSCredentialManagementClient) List

List retrieves a list of AWS credentials and returns a slice of CloudProviderStatus objects containing the name and enabled status of each credential. If an error occurs, an error is returned.

func (*AWSCredentialManagementClient) Put

"Put" checks if the credential type is "AWSCredential" and if so, creates or updates the credential in the AWS plane, otherwise it returns an error.

type AWSCredentialManagementClientInterface

type AWSCredentialManagementClientInterface interface {
	// Get gets the credential registered with the given ucp provider plane.
	Get(ctx context.Context, name string) (ProviderCredentialConfiguration, error)
	// List lists the credentials registered with all ucp provider planes.
	List(ctx context.Context) ([]CloudProviderStatus, error)
	// Put registers an AWS credential with the respective ucp provider plane.
	Put(ctx context.Context, credential_config ucp.AwsCredentialResource) error
	// Delete unregisters credential from the given ucp provider plane.
	Delete(ctx context.Context, name string) (bool, error)
}

AWSCredentialManagementClient is used to interface with cloud provider configuration and credentials.

type AWSCredentialProperties

type AWSCredentialProperties struct {
	// Kind is the credential kind (AccessKey or IRSA)
	Kind *string

	// AccessKey is the properties for an AWS access key credential
	AccessKey *AWSAccessKeyCredentialProperties

	// IRSA is the properties for an AWS IRSA credential
	IRSA *AWSIRSACredentialProperties
}

type AWSIRSACredentialProperties added in v0.37.0

type AWSIRSACredentialProperties struct {
	// Kind is the credential kind (Must be IRSA)
	Kind *string

	// RoleARN is the AWS IRSA role ARN
	RoleARN *string
}

type AzureCredentialManagementClient

type AzureCredentialManagementClient struct {
	AzureCredentialClient ucp.AzureCredentialsClient
}

AzureCredentialManagementClient is used to interface with cloud provider configuration and credentials.

func (*AzureCredentialManagementClient) Delete

func (cpm *AzureCredentialManagementClient) Delete(ctx context.Context, name string) (bool, error)

"Delete" checks if the credential for the provider plane is registered and returns true if not found, otherwise returns false and an error if one occurs.

func (*AzureCredentialManagementClient) Get

"Get" retrieves an AzureCredentialResource from the AzureCredentialClient and returns a ProviderCredentialConfiguration object, or an error if the retrieval fails.

func (*AzureCredentialManagementClient) List

List retrieves a list of Azure credentials and returns a slice of CloudProviderStatus objects containing the name and enabled status of each credential.

func (*AzureCredentialManagementClient) Put

"Put" checks if the credential type is supported by the AzureCredentialManagementClient, and if so, creates or updates the credential in Azure, otherwise it returns an error.

type AzureCredentialManagementClientInterface

type AzureCredentialManagementClientInterface interface {
	// Get gets the credential registered with the given ucp provider plane.
	Get(ctx context.Context, name string) (ProviderCredentialConfiguration, error)
	// List lists the credentials registered with all ucp provider planes.
	List(ctx context.Context) ([]CloudProviderStatus, error)
	// Put registers an AWS credential with the respective ucp provider plane.
	Put(ctx context.Context, credential_config ucp.AzureCredentialResource) error
	// Delete unregisters credential from the given ucp provider plane.
	Delete(ctx context.Context, name string) (bool, error)
}

AzureCredentialManagementClient is used to interface with cloud provider configuration and credentials.

type AzureCredentialProperties

type AzureCredentialProperties struct {
	// Kind is the credential kind (ServicePrincipal or WorkloadIdentity)
	Kind *string

	// ServicePrincipal is the properties for an Azure service principal credential
	ServicePrincipal *AzureServicePrincipalCredentialProperties

	// WorkloadIdentity is the properties for an Azure workload identity credential
	WorkloadIdentity *AzureWorkloadIdentityCredentialProperties
}

AzureCredentialProperties is the representation of an Azure credential. It contains the kind of the credential (ServicePrincipal or WorkloadIdentity) and the properties for each kind.

type AzureServicePrincipalCredentialProperties added in v0.35.0

type AzureServicePrincipalCredentialProperties struct {
	// clientId for the Azure credential
	ClientID *string

	// kind for the Azure credential (must be ServicePrincipal)
	Kind *string

	// tenantId for the Azure credential
	TenantID *string
}

AzureServicePrincipalCredentialProperties is the representation of an Azure service principal credential.

type AzureWorkloadIdentityCredentialProperties added in v0.35.0

type AzureWorkloadIdentityCredentialProperties struct {
	// clientId for the Azure credential
	ClientID *string

	// kind for the Azure credential (must be WorkloadIdentity)
	Kind *string

	// tenantId for the Azure credential
	TenantID *string
}

AzureWorkloadIdentityCredentialProperties is the representation of an Azure workload identity credential.

type CloudProviderStatus

type CloudProviderStatus struct {
	// Name is the name/kind of the provider. For right now this only supports Azure and AWS.
	Name string

	// Enabled is the enabled/disabled status of the provider.
	Enabled bool
}

CloudProviderStatus is the representation of a cloud provider configuration.

type CredentialManagementClient

type CredentialManagementClient interface {
	// Get gets the credential registered with the given ucp provider plane.
	Get(ctx context.Context, providerName string) (ProviderCredentialConfiguration, error)
	// List lists the credentials registered with all ucp provider planes.
	List(ctx context.Context) ([]CloudProviderStatus, error)
	// PutAWS registers an AWS credential with the respective ucp provider plane.
	PutAWS(ctx context.Context, credential_config ucp.AwsCredentialResource) error
	// PutAzure registers an Azure credential with the respective ucp provider plane.
	PutAzure(ctx context.Context, credential_config ucp.AzureCredentialResource) error
	// Delete unregisters credential from the given ucp provider plane.
	Delete(ctx context.Context, providerName string) (bool, error)
}

CredentialManagementClient is used to interface with cloud provider configuration and credentials.

type ErrUnsupportedCloudProvider

type ErrUnsupportedCloudProvider struct {
	Message string
}

ErrUnsupportedCloudProvider represents error when the cloud provider is not supported by radius.

func (*ErrUnsupportedCloudProvider) Error

func (fe *ErrUnsupportedCloudProvider) Error() string

ErrUnsupportedCloudProvider's Error() function returns a string indicating an unsupported cloud provider when called.

func (*ErrUnsupportedCloudProvider) Is

func (fe *ErrUnsupportedCloudProvider) Is(target error) bool

Is() checks if the target error is of type ErrUnsupportedCloudProvider and returns a boolean value indicating the result.

type MockAWSCredentialManagementClientInterface

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

MockAWSCredentialManagementClientInterface is a mock of AWSCredentialManagementClientInterface interface.

func NewMockAWSCredentialManagementClientInterface

func NewMockAWSCredentialManagementClientInterface(ctrl *gomock.Controller) *MockAWSCredentialManagementClientInterface

NewMockAWSCredentialManagementClientInterface creates a new mock instance.

func (*MockAWSCredentialManagementClientInterface) Delete

Delete mocks base method.

func (*MockAWSCredentialManagementClientInterface) EXPECT

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

func (*MockAWSCredentialManagementClientInterface) Get

Get mocks base method.

func (*MockAWSCredentialManagementClientInterface) List

List mocks base method.

func (*MockAWSCredentialManagementClientInterface) Put

Put mocks base method.

type MockAWSCredentialManagementClientInterfaceDeleteCall added in v0.35.0

type MockAWSCredentialManagementClientInterfaceDeleteCall struct {
	*gomock.Call
}

MockAWSCredentialManagementClientInterfaceDeleteCall wrap *gomock.Call

func (*MockAWSCredentialManagementClientInterfaceDeleteCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockAWSCredentialManagementClientInterfaceDeleteCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAWSCredentialManagementClientInterfaceDeleteCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockAWSCredentialManagementClientInterfaceGetCall added in v0.35.0

type MockAWSCredentialManagementClientInterfaceGetCall struct {
	*gomock.Call
}

MockAWSCredentialManagementClientInterfaceGetCall wrap *gomock.Call

func (*MockAWSCredentialManagementClientInterfaceGetCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockAWSCredentialManagementClientInterfaceGetCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAWSCredentialManagementClientInterfaceGetCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockAWSCredentialManagementClientInterfaceListCall added in v0.35.0

type MockAWSCredentialManagementClientInterfaceListCall struct {
	*gomock.Call
}

MockAWSCredentialManagementClientInterfaceListCall wrap *gomock.Call

func (*MockAWSCredentialManagementClientInterfaceListCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockAWSCredentialManagementClientInterfaceListCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAWSCredentialManagementClientInterfaceListCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockAWSCredentialManagementClientInterfaceMockRecorder

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

MockAWSCredentialManagementClientInterfaceMockRecorder is the mock recorder for MockAWSCredentialManagementClientInterface.

func (*MockAWSCredentialManagementClientInterfaceMockRecorder) Delete

Delete indicates an expected call of Delete.

func (*MockAWSCredentialManagementClientInterfaceMockRecorder) Get

Get indicates an expected call of Get.

func (*MockAWSCredentialManagementClientInterfaceMockRecorder) List

List indicates an expected call of List.

func (*MockAWSCredentialManagementClientInterfaceMockRecorder) Put

Put indicates an expected call of Put.

type MockAWSCredentialManagementClientInterfacePutCall added in v0.35.0

type MockAWSCredentialManagementClientInterfacePutCall struct {
	*gomock.Call
}

MockAWSCredentialManagementClientInterfacePutCall wrap *gomock.Call

func (*MockAWSCredentialManagementClientInterfacePutCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockAWSCredentialManagementClientInterfacePutCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAWSCredentialManagementClientInterfacePutCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockAzureCredentialManagementClientInterface

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

MockAzureCredentialManagementClientInterface is a mock of AzureCredentialManagementClientInterface interface.

func NewMockAzureCredentialManagementClientInterface

func NewMockAzureCredentialManagementClientInterface(ctrl *gomock.Controller) *MockAzureCredentialManagementClientInterface

NewMockAzureCredentialManagementClientInterface creates a new mock instance.

func (*MockAzureCredentialManagementClientInterface) Delete

Delete mocks base method.

func (*MockAzureCredentialManagementClientInterface) EXPECT

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

func (*MockAzureCredentialManagementClientInterface) Get

Get mocks base method.

func (*MockAzureCredentialManagementClientInterface) List

List mocks base method.

func (*MockAzureCredentialManagementClientInterface) Put

Put mocks base method.

type MockAzureCredentialManagementClientInterfaceDeleteCall added in v0.35.0

type MockAzureCredentialManagementClientInterfaceDeleteCall struct {
	*gomock.Call
}

MockAzureCredentialManagementClientInterfaceDeleteCall wrap *gomock.Call

func (*MockAzureCredentialManagementClientInterfaceDeleteCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockAzureCredentialManagementClientInterfaceDeleteCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAzureCredentialManagementClientInterfaceDeleteCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockAzureCredentialManagementClientInterfaceGetCall added in v0.35.0

type MockAzureCredentialManagementClientInterfaceGetCall struct {
	*gomock.Call
}

MockAzureCredentialManagementClientInterfaceGetCall wrap *gomock.Call

func (*MockAzureCredentialManagementClientInterfaceGetCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockAzureCredentialManagementClientInterfaceGetCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAzureCredentialManagementClientInterfaceGetCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockAzureCredentialManagementClientInterfaceListCall added in v0.35.0

type MockAzureCredentialManagementClientInterfaceListCall struct {
	*gomock.Call
}

MockAzureCredentialManagementClientInterfaceListCall wrap *gomock.Call

func (*MockAzureCredentialManagementClientInterfaceListCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockAzureCredentialManagementClientInterfaceListCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAzureCredentialManagementClientInterfaceListCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockAzureCredentialManagementClientInterfaceMockRecorder

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

MockAzureCredentialManagementClientInterfaceMockRecorder is the mock recorder for MockAzureCredentialManagementClientInterface.

func (*MockAzureCredentialManagementClientInterfaceMockRecorder) Delete

Delete indicates an expected call of Delete.

func (*MockAzureCredentialManagementClientInterfaceMockRecorder) Get

Get indicates an expected call of Get.

func (*MockAzureCredentialManagementClientInterfaceMockRecorder) List

List indicates an expected call of List.

func (*MockAzureCredentialManagementClientInterfaceMockRecorder) Put

Put indicates an expected call of Put.

type MockAzureCredentialManagementClientInterfacePutCall added in v0.35.0

type MockAzureCredentialManagementClientInterfacePutCall struct {
	*gomock.Call
}

MockAzureCredentialManagementClientInterfacePutCall wrap *gomock.Call

func (*MockAzureCredentialManagementClientInterfacePutCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockAzureCredentialManagementClientInterfacePutCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockAzureCredentialManagementClientInterfacePutCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockCredentialManagementClient

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

MockCredentialManagementClient is a mock of CredentialManagementClient interface.

func NewMockCredentialManagementClient

func NewMockCredentialManagementClient(ctrl *gomock.Controller) *MockCredentialManagementClient

NewMockCredentialManagementClient creates a new mock instance.

func (*MockCredentialManagementClient) Delete

Delete mocks base method.

func (*MockCredentialManagementClient) EXPECT

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

func (*MockCredentialManagementClient) Get

Get mocks base method.

func (*MockCredentialManagementClient) List

List mocks base method.

func (*MockCredentialManagementClient) PutAWS

PutAWS mocks base method.

func (*MockCredentialManagementClient) PutAzure

PutAzure mocks base method.

type MockCredentialManagementClientDeleteCall added in v0.35.0

type MockCredentialManagementClientDeleteCall struct {
	*gomock.Call
}

MockCredentialManagementClientDeleteCall wrap *gomock.Call

func (*MockCredentialManagementClientDeleteCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockCredentialManagementClientDeleteCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockCredentialManagementClientDeleteCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockCredentialManagementClientGetCall added in v0.35.0

type MockCredentialManagementClientGetCall struct {
	*gomock.Call
}

MockCredentialManagementClientGetCall wrap *gomock.Call

func (*MockCredentialManagementClientGetCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockCredentialManagementClientGetCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockCredentialManagementClientGetCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockCredentialManagementClientListCall added in v0.35.0

type MockCredentialManagementClientListCall struct {
	*gomock.Call
}

MockCredentialManagementClientListCall wrap *gomock.Call

func (*MockCredentialManagementClientListCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockCredentialManagementClientListCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockCredentialManagementClientListCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockCredentialManagementClientMockRecorder

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

MockCredentialManagementClientMockRecorder is the mock recorder for MockCredentialManagementClient.

func (*MockCredentialManagementClientMockRecorder) Delete

Delete indicates an expected call of Delete.

func (*MockCredentialManagementClientMockRecorder) Get

Get indicates an expected call of Get.

func (*MockCredentialManagementClientMockRecorder) List

List indicates an expected call of List.

func (*MockCredentialManagementClientMockRecorder) PutAWS

PutAWS indicates an expected call of PutAWS.

func (*MockCredentialManagementClientMockRecorder) PutAzure

PutAzure indicates an expected call of PutAzure.

type MockCredentialManagementClientPutAWSCall added in v0.35.0

type MockCredentialManagementClientPutAWSCall struct {
	*gomock.Call
}

MockCredentialManagementClientPutAWSCall wrap *gomock.Call

func (*MockCredentialManagementClientPutAWSCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockCredentialManagementClientPutAWSCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockCredentialManagementClientPutAWSCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type MockCredentialManagementClientPutAzureCall added in v0.35.0

type MockCredentialManagementClientPutAzureCall struct {
	*gomock.Call
}

MockCredentialManagementClientPutAzureCall wrap *gomock.Call

func (*MockCredentialManagementClientPutAzureCall) Do added in v0.35.0

Do rewrite *gomock.Call.Do

func (*MockCredentialManagementClientPutAzureCall) DoAndReturn added in v0.35.0

DoAndReturn rewrite *gomock.Call.DoAndReturn

func (*MockCredentialManagementClientPutAzureCall) Return added in v0.35.0

Return rewrite *gomock.Call.Return

type ProviderCredentialConfiguration

type ProviderCredentialConfiguration struct {
	CloudProviderStatus

	// AzureCredentials is used to set the credentials on Puts. It is NOT returned on Get/List.
	AzureCredentials *AzureCredentialProperties

	// AWSCredentials is used to set the credentials on Puts. It is NOT returned on Get/List.
	AWSCredentials *AWSCredentialProperties
}

type UCPCredentialManagementClient

type UCPCredentialManagementClient struct {
	AzClient  AzureCredentialManagementClientInterface
	AWSClient AWSCredentialManagementClientInterface
}

UCPCredentialManagementClient implements operations to manage credentials on ucp.

func (*UCPCredentialManagementClient) Delete

func (cpm *UCPCredentialManagementClient) Delete(ctx context.Context, providerName string) (bool, error)

Delete() checks the provider name and calls the appropriate client's Delete function to delete the default secret name. It returns a boolean and an error if the provider name is invalid.

func (*UCPCredentialManagementClient) Get

Get retrieves the credential configuration for the specified cloud provider from the backend, or returns an error if the credential is not found or an error occurs. If the credential is not found, an empty credential configuration with the cloud provider's status set to disabled is returned.

func (*UCPCredentialManagementClient) List

List() lists the credentials from both Azure and AWS and returns a slice of CloudProviderStatus. It returns an error if either of the list operations fail.

func (*UCPCredentialManagementClient) PutAWS

PutAWS function takes in a context and an AWSCredentialResource object and returns an error if the AWSClient.Put call fails.

func (*UCPCredentialManagementClient) PutAzure

PutAzure takes in a context and an AzureCredentialResource object and attempts to store it through the Azure Client, returning an error if unsuccessful.

Jump to

Keyboard shortcuts

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