instance

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Jan 19, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Credentials        Credentials `json:"credentials"`
	PermissionsEnabled bool        `json:"permissionsEnabled"`
}

Config is the structure of the configuration for a single Azure instance.

type Credentials

type Credentials struct {
	SubscriptionID string `json:"subscriptionID"`
	TenantID       string `json:"tenantID"`
	ClientID       string `json:"clientID"`
	ClientSecret   string `json:"clientSecret"`
}

Credentials is the structure of the required information to authenticate against the Azure API.

type Instance

type Instance interface {
	GetName() string
	ResourceGroupsClient() resourcegroups.Client
	KubernetesServicesClient() kubernetesservices.Client
	ContainerInstancesClient() containerinstances.Client
	CostManagementClient() costmanagement.Client
	VirtualMachineScaleSetsClient() virtualmachinescalesets.Client
	MonitorClient() monitor.Client
	CheckPermissions(pluginName string, user *authContext.User, resource, resourceGroup, verb string) error
}

Instance is the interface which must be implemented by an Azure instance.

func New

func New(name string, options map[string]any) (Instance, error)

New returns a new Azure instance for the given configuration.

type MockInstance

type MockInstance struct {
	mock.Mock
}

MockInstance is an autogenerated mock type for the Instance type

func NewMockInstance

func NewMockInstance(t NewMockInstanceT) *MockInstance

NewMockInstance creates a new instance of MockInstance. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.

func (*MockInstance) CheckPermissions

func (_m *MockInstance) CheckPermissions(pluginName string, user *context.User, resource string, resourceGroup string, verb string) error

CheckPermissions provides a mock function with given fields: pluginName, user, resource, resourceGroup, verb

func (*MockInstance) ContainerInstancesClient

func (_m *MockInstance) ContainerInstancesClient() containerinstances.Client

ContainerInstancesClient provides a mock function with given fields:

func (*MockInstance) CostManagementClient

func (_m *MockInstance) CostManagementClient() costmanagement.Client

CostManagementClient provides a mock function with given fields:

func (*MockInstance) GetName

func (_m *MockInstance) GetName() string

GetName provides a mock function with given fields:

func (*MockInstance) KubernetesServicesClient

func (_m *MockInstance) KubernetesServicesClient() kubernetesservices.Client

KubernetesServicesClient provides a mock function with given fields:

func (*MockInstance) MonitorClient

func (_m *MockInstance) MonitorClient() monitor.Client

MonitorClient provides a mock function with given fields:

func (*MockInstance) ResourceGroupsClient

func (_m *MockInstance) ResourceGroupsClient() resourcegroups.Client

ResourceGroupsClient provides a mock function with given fields:

func (*MockInstance) VirtualMachineScaleSetsClient

func (_m *MockInstance) VirtualMachineScaleSetsClient() virtualmachinescalesets.Client

VirtualMachineScaleSetsClient provides a mock function with given fields:

type NewMockInstanceT

type NewMockInstanceT interface {
	mock.TestingT
	Cleanup(func())
}

type Permissions

type Permissions struct {
	Resources      []string `json:"resources"`
	ResourceGroups []string `json:"resourceGroups"`
	Verbs          []string `json:"verbs"`
}

Permissions is the structure of the custom permissions field for the Azure instance.

Jump to

Keyboard shortcuts

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