azure

package
v0.0.20 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2024 License: Apache-2.0 Imports: 12 Imported by: 1

Documentation

Overview

Package azure implements utilities that relate to more than one thing we want to do with Azure for the plugin's validation logic.

Index

Constants

View Source
const TestClientTimeout = 10 * time.Second

TestClientTimeout is the timeout used for Azure clients during tests.

Variables

This section is empty.

Functions

func RoleNameFromRoleDefinitionID

func RoleNameFromRoleDefinitionID(roleDefinitionID string) string

RoleNameFromRoleDefinitionID extracts the name of a role (aka the non-fully-qualified ID of the role) from an Azure role definition ID (aka the fully-qualified ID of the role definition).

Types

type API

type API struct {
	DenyAssignmentsClient *armauthorization.DenyAssignmentsClient
	RoleAssignmentsClient *armauthorization.RoleAssignmentsClient
	RoleDefinitionsClient *armauthorization.RoleDefinitionsClient
	// Subscription ID is needed per API call for this client, so the client can't be created until
	// right before it's used while reconciling a rule.
	CommunityGalleryImagesClientProducer func(string) (*armcompute.CommunityGalleryImagesClient, error)
}

API is an container that aggregates Azure service clients.

func NewAzureAPI

func NewAzureAPI() (*API, error)

NewAzureAPI creates an AzureAPI.

type CommunityGalleryImagesClient

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

CommunityGalleryImagesClient is a facade over the Azure community gallery images client. Exists to make our code easier to test (it handles paging).

func NewCommunityGalleryImagesClient

func NewCommunityGalleryImagesClient(ctx context.Context, azClientProducer func(subscriptionID string) (*armcompute.CommunityGalleryImagesClient, error)) *CommunityGalleryImagesClient

NewCommunityGalleryImagesClient creates a new AzureRoleDefinitionsClient (our facade client) from a client from the Azure SDK.

func (*CommunityGalleryImagesClient) GetImagesForGallery

func (c *CommunityGalleryImagesClient) GetImagesForGallery(location, name, subscriptionID string) ([]*armcompute.CommunityGalleryImage, error)

GetImagesForGallery gets all the images in a community gallery.

type DenyAssignmentsClient

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

DenyAssignmentsClient is a facade over the Azure deny assignments client. Exists to make our code easier to test (it handles paging).

func NewDenyAssignmentsClient

func NewDenyAssignmentsClient(ctx context.Context, azClient *armauthorization.DenyAssignmentsClient) *DenyAssignmentsClient

NewDenyAssignmentsClient creates a new AzureDenyAssignmentsClient (our facade client) from a client from the Azure SDK.

func (*DenyAssignmentsClient) GetDenyAssignmentsForScope

func (c *DenyAssignmentsClient) GetDenyAssignmentsForScope(scope string, filter *string) ([]*armauthorization.DenyAssignment, error)

GetDenyAssignmentsForScope gets all the deny assignments matching a scope and an optional filter.

type RoleAssignmentsClient

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

RoleAssignmentsClient is a facade over the Azure role assignments client. Exists to make our code easier to test (it handles paging).

func NewRoleAssignmentsClient

func NewRoleAssignmentsClient(ctx context.Context, azClient *armauthorization.RoleAssignmentsClient) *RoleAssignmentsClient

NewRoleAssignmentsClient creates a new AzureRoleAssignmentsClient (our facade client) from a client from the Azure SDK.

func (*RoleAssignmentsClient) GetRoleAssignmentsForScope

func (c *RoleAssignmentsClient) GetRoleAssignmentsForScope(scope string, filter *string) ([]*armauthorization.RoleAssignment, error)

GetRoleAssignmentsForScope gets all the role assignments matching a scope and an optional filter.

type RoleDefinitionsClient

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

RoleDefinitionsClient is a facade over the Azure role definitions client. Code that uses this instead of the actual Azure client is easier to test because it won't need to deal with finding the permissions part of the API response.

func NewRoleDefinitionsClient

func NewRoleDefinitionsClient(ctx context.Context, azClient *armauthorization.RoleDefinitionsClient) *RoleDefinitionsClient

NewRoleDefinitionsClient creates a new AzureRoleDefinitionsClient (our facade client) from a client from the Azure SDK.

func (*RoleDefinitionsClient) GetByID

func (c *RoleDefinitionsClient) GetByID(roleID string) (*armauthorization.RoleDefinition, error)

GetByID gets the role definition associated with a role assignment because it uses the fully-qualified role ID contained within the role assignment data to retrieve it from Azure.

Jump to

Keyboard shortcuts

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