azureclient

package
v0.0.0-...-1737087 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: Apache-2.0 Imports: 19 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// PublicCloud contains additional ARO information for the public Azure cloud environment.
	PublicCloud = AROEnvironment{
		Environment:              azure.PublicCloud,
		ActualCloudName:          "AzureCloud",
		GenevaMonitoringEndpoint: "https://gcs.prod.monitoring.core.windows.net/",
		AppSuffix:                "aro.azure.com",
		AppLensEndpoint:          "https://diag-runtimehost-prod.trafficmanager.net/api/invoke",
		AppLensScope:             "0d7b6142-46a3-426a-ad6d-eed97c2a48ee",
		AppLensTenantID:          "33e01921-4d64-4f8c-a055-5bdaffd5e33d",
		PkiIssuerUrlTemplate:     "https://issuer.pki.azure.com/dsms/issuercertificates?getissuersv3&caName=%s",
		PkiCaName:                "ame",
		Cloud:                    cloud.AzurePublic,
		AzureRbacPDPEnvironment: AzureRbacPDPEnvironment{
			Endpoint:   "https://%s.authorization.azure.net/providers/Microsoft.Authorization/checkAccess?api-version=2021-06-01-preview",
			OAuthScope: "https://authorization.azure.net/.default",
		},
		ResourceManagerScope:   azure.PublicCloud.ResourceManagerEndpoint + "/.default",
		KeyVaultScope:          azure.PublicCloud.ResourceIdentifiers.KeyVault + "/.default",
		MicrosoftGraphScope:    azure.PublicCloud.MicrosoftGraphEndpoint + "/.default",
		CosmosDBDNSSuffixScope: azure.PublicCloud.CosmosDBDNSSuffix + "/.default",
	}

	// USGovernmentCloud contains additional ARO information for the US Gov cloud environment.
	USGovernmentCloud = AROEnvironment{
		Environment:              azure.USGovernmentCloud,
		ActualCloudName:          "AzureUSGovernment",
		GenevaMonitoringEndpoint: "https://gcs.monitoring.core.usgovcloudapi.net/",
		AppSuffix:                "aro.azure.us",
		AppLensEndpoint:          "https://diag-runtimehost-prod-bn1-001.azurewebsites.us/api/invoke",
		AppLensScope:             "https://microsoft.onmicrosoft.com/runtimehost",
		AppLensTenantID:          "cab8a31a-1906-4287-a0d8-4eef66b95f6e",
		Cloud:                    cloud.AzureGovernment,

		PkiIssuerUrlTemplate: "",
		PkiCaName:            "",
		AzureRbacPDPEnvironment: AzureRbacPDPEnvironment{
			Endpoint:   "https://%s.authorization.azure.us/providers/Microsoft.Authorization/checkAccess?api-version=2021-06-01-preview",
			OAuthScope: "https://authorization.azure.us/.default",
		},
		ResourceManagerScope:   azure.USGovernmentCloud.ResourceManagerEndpoint + "/.default",
		KeyVaultScope:          azure.USGovernmentCloud.ResourceIdentifiers.KeyVault + "/.default",
		MicrosoftGraphScope:    azure.USGovernmentCloud.MicrosoftGraphEndpoint + "/.default",
		CosmosDBDNSSuffixScope: azure.USGovernmentCloud.CosmosDBDNSSuffix + "/.default",
	}
)

Functions

func APIVersion

func APIVersion(typ string) string

APIVersion gets the APIVersion from a full resource type

func DecorateSenderWithLogging

func DecorateSenderWithLogging(sender autorest.Sender) autorest.Sender

DecorateSenderWithLogging decorates a sender in order to intercept HTTP calls using a custom RoundTripper and log low level HTTP request's information.

func NewCustomRoundTripper

func NewCustomRoundTripper(next http.RoundTripper) http.RoundTripper

Types

type AROEnvironment

type AROEnvironment struct {
	azure.Environment
	ActualCloudName          string
	GenevaMonitoringEndpoint string
	AppSuffix                string
	AppLensEndpoint          string
	AppLensScope             string
	AppLensTenantID          string
	PkiIssuerUrlTemplate     string
	PkiCaName                string
	AuthzRemotePDPEndPoint   string
	AzureRbacPDPEnvironment
	Cloud cloud.Configuration
	// Microsoft identity platform scopes used by ARO
	// See https://learn.microsoft.com/EN-US/azure/active-directory/develop/scopes-oidc#the-default-scope
	ResourceManagerScope   string
	KeyVaultScope          string
	MicrosoftGraphScope    string
	CosmosDBDNSSuffixScope string
}

AROEnvironment contains additional, cloud-specific information needed by ARO.

func EnvironmentFromName

func EnvironmentFromName(name string) (AROEnvironment, error)

EnvironmentFromName returns the AROEnvironment corresponding to the common name specified.

func (*AROEnvironment) ArmClientOptions

func (e *AROEnvironment) ArmClientOptions() *arm.ClientOptions

ArmClientOptions returns an arm.ClientOptions to be passed in when instantiating Azure SDK for Go clients.

func (*AROEnvironment) ClientCertificateCredentialOptions

func (e *AROEnvironment) ClientCertificateCredentialOptions(additionalTenants []string) *azidentity.ClientCertificateCredentialOptions

func (*AROEnvironment) ClientSecretCredentialOptions

func (e *AROEnvironment) ClientSecretCredentialOptions() *azidentity.ClientSecretCredentialOptions

func (*AROEnvironment) CloudNameForMsiDataplane

func (e *AROEnvironment) CloudNameForMsiDataplane() (string, error)

CloudNameForMsiDataplane returns the cloud name to be passed in when instantiating an MSI dataplane client or an error if it encounters an issue getting the correct cloud name. This function might seem a little strange, but it's necessary because the cloud names stored in the AROEnvironments are in all-caps, whereas the ones defined as constants in the dataplane module are in camel case.

func (*AROEnvironment) DefaultAzureCredentialOptions

func (e *AROEnvironment) DefaultAzureCredentialOptions() *azidentity.DefaultAzureCredentialOptions

func (*AROEnvironment) EnvironmentCredentialOptions

func (e *AROEnvironment) EnvironmentCredentialOptions() *azidentity.EnvironmentCredentialOptions

func (*AROEnvironment) ManagedIdentityCredentialOptions

func (e *AROEnvironment) ManagedIdentityCredentialOptions() *azidentity.ManagedIdentityCredentialOptions

func (*AROEnvironment) NewGraphServiceClient

func (e *AROEnvironment) NewGraphServiceClient(tokenCredential azcore.TokenCredential) (*utilgraph.GraphServiceClient, error)

type AzureRbacPDPEnvironment

type AzureRbacPDPEnvironment struct {
	Endpoint   string
	OAuthScope string
}

AzureRbacPDPEnvironment contains cloud specific instance of Authz RBAC PDP Remote Server

type LoggingSender

type LoggingSender struct {
	autorest.Sender
}

LoggingSender intercepts requests and logs them out. Usage: client.Sender = &LoggingSender{client.Sender}

func (*LoggingSender) Do

func (ls *LoggingSender) Do(req *http.Request) (*http.Response, error)

Jump to

Keyboard shortcuts

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