credential

package
v0.29.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 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 (
	AzureCredential = "azure"
	AzurePlaneName  = "azurecloud"
)
View Source
const (
	AzurePlaneType = "azure"
	AWSPlaneType   = "aws"
)

Variables

This section is empty.

Functions

This section is empty.

Types

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 {
	// AccessKeyID is the access key ID for the AWS credential.
	AccessKeyID *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 {
	// clientId for ServicePrincipal
	ClientID *string

	// The credential kind
	Kind *string

	// tenantId for ServicePrincipal
	TenantID *string
}

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 MockAWSCredentialManagementClientInterfaceMockRecorder

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

MockAWSCredentialManagementClientInterfaceMockRecorder is the mock recorder for MockAWSCredentialManagementClientInterface.

func (*MockAWSCredentialManagementClientInterfaceMockRecorder) Delete

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

Delete indicates an expected call of Delete.

func (*MockAWSCredentialManagementClientInterfaceMockRecorder) Get

func (mr *MockAWSCredentialManagementClientInterfaceMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockAWSCredentialManagementClientInterfaceMockRecorder) List

List indicates an expected call of List.

func (*MockAWSCredentialManagementClientInterfaceMockRecorder) Put

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

Put indicates an expected call of Put.

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 MockAzureCredentialManagementClientInterfaceMockRecorder

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

MockAzureCredentialManagementClientInterfaceMockRecorder is the mock recorder for MockAzureCredentialManagementClientInterface.

func (*MockAzureCredentialManagementClientInterfaceMockRecorder) Delete

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

Delete indicates an expected call of Delete.

func (*MockAzureCredentialManagementClientInterfaceMockRecorder) Get

func (mr *MockAzureCredentialManagementClientInterfaceMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockAzureCredentialManagementClientInterfaceMockRecorder) List

List indicates an expected call of List.

func (*MockAzureCredentialManagementClientInterfaceMockRecorder) Put

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

Put indicates an expected call of Put.

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 MockCredentialManagementClientMockRecorder

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

MockCredentialManagementClientMockRecorder is the mock recorder for MockCredentialManagementClient.

func (*MockCredentialManagementClientMockRecorder) Delete

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

Delete indicates an expected call of Delete.

func (*MockCredentialManagementClientMockRecorder) Get

func (mr *MockCredentialManagementClientMockRecorder) Get(arg0, arg1 interface{}) *gomock.Call

Get indicates an expected call of Get.

func (*MockCredentialManagementClientMockRecorder) List

func (mr *MockCredentialManagementClientMockRecorder) List(arg0 interface{}) *gomock.Call

List indicates an expected call of List.

func (*MockCredentialManagementClientMockRecorder) PutAWS

func (mr *MockCredentialManagementClientMockRecorder) PutAWS(arg0, arg1 interface{}) *gomock.Call

PutAWS indicates an expected call of PutAWS.

func (*MockCredentialManagementClientMockRecorder) PutAzure

func (mr *MockCredentialManagementClientMockRecorder) PutAzure(arg0, arg1 interface{}) *gomock.Call

PutAzure indicates an expected call of PutAzure.

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