azurearm

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 90 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README ¶

Azurearm

Parity grade: B · SDK hashicorp/terraform-provider-azurerm@v4.81.0 · last audited 2026-09-12 (f973f0c90)

Coverage

Metric Value
PARITY entries audited 21 (15 ok, 3 partial, 3 gap)
Feature families 28 (28 ok)
Known gaps 42
Deferred items 3
Resource leaks clean
Known gaps
  • Storage RP account state (StorageProvider.accounts) does not survive a snapshot/restore cycle -- only InMemoryBackend's resource-group/generic-resource/provider-registration state is persisted (see ops.StorageAccountCRUD). Fix is additive: give StorageProvider its own Snapshot/Restore and wire it into Handler.Snapshot/Restore alongside the backend's.
  • ServiceBus RP state (ServiceBusProvider's namespaces/queues/topics/subscriptions maps) does not survive a snapshot/restore cycle either, the same known gap as StorageAccountCRUD above and for the same reason -- no ResourceProvider's own state is currently wired into Handler.Snapshot/Restore.
  • TestTerraform_Azure_ServiceBus (M9) could not be confirmed against a live tofu apply on this milestone's local macOS development sandbox, due to the same pre-existing host-OS-specific TLS-trust gap documented for M7/M8 (AZURE.md section 10.10) -- apply fails at ARM's own metadata-discovery call, before reaching any ServiceBus-specific code. Compensating verification: test/integration/azurearm_test.go's TestIntegration_AzureARM_ServiceBusLifecycleAndCrossServiceWiring exercises the identical ARM CRUD + cross-service-wiring path over plain HTTP and passed; wire-shape questions were answered by reading the pinned terraform-provider-azurerm/go-azure-sdk source directly. Should be re-confirmed against a green CI run (expected to work on Linux).
  • Token endpoint accepts any (or a missing) client_id/grant_type without validation and always issues a token; a malformed client_credentials request should arguably 400 with invalid_request/unsupported_grant_type per RFC 6749, matching AAD's own error shape more closely.
  • Direct-data-plane storage resources (azurerm_storage_container/_blob/_queue/_table) are covered as of M8 via the new services/azurestoragevhost virtual-hosted-style listener (AZURE.md section 10.8 finding (9)); azurerm_storage_share (File Share) remains out of scope -- no gopherstack file-share service exists.
  • Multi-account namespace isolation: all ARM-created storage accounts alias one shared Blob/Queue/Table container/queue/table namespace (services/azureblob/azurequeue/azuretable discard the account-name path segment entirely). Two ARM storage accounts see each other's containers. Deferred to M10 per AZURE.md section 10.4's original note; StorageAccounts.RegisterAccount/DeleteAccount (interfaces.go) is the forward-compat seam for that fix.
  • ARM error codes are a small hand-picked table (errors.go's errorDetails), not audited against ARM's full published error-code catalog the way services/sqs's errorDetails table has been over multiple audit passes.
  • management locks, Azure Policy, RBAC/Microsoft.Authorization, ARM template deployments (Microsoft.Resources/deployments), PATCH-merge semantics beyond full-replace, $filter/$expand and nextLink pagination on list operations, cross-subscription/cross-tenant, resource moves, What-If, and LRO polling are all explicitly out of MVP scope per AZURE.md section 10.1/10.3 -- not bugs, deliberate scope boundaries for this milestone.
  • Microsoft.Search: network security perimeter configurations are not modelled (Microsoft.Network networkSecurityPerimeters is not a modelled type, so a perimeter cannot be created to associate a service with).
  • Flexible servers: not routed (generic store or 404): migrations (MySQL cutoverMigration), maintenances (platform-scheduled, nothing in the emulator creates one), logFiles (the engine exposes no log files), backupAndExport (no storage export target), resetGtid (no GTID state), private endpoint connections and PostgreSQL advanced threat protection (the specification has it, armpostgresqlflexibleservers v2.1.1 has no client). Entra administrators (PostgreSQL administrators/{objectId}, MySQL administrators/ActiveDirectory) and the MySQL forced failover are modelled, but the objectId is not resolved against services/azuregraph.
  • Flexible servers: max_connections defaults follow the documented per-SKU tables for both engines, but the docker engine is not started with that value (a parameter you set, or reset, is applied); the PostgreSQL max_connections range, every other parameter default/range/allowed value, and the MySQL storage IOPS formula (360 minimum, 3 per GiB) are not taken from a published table; azure.extensions (PostgreSQL) and require_secure_transport (MySQL) are stored but not pushed to the engine.
  • Flexible servers: firewall rules (including the 0.0.0.0 allow-Azure-services rule) and publicNetworkAccess are stored and validated but not enforced: clients connect straight to the container port published on loopback (gopherstackEndpoint) and no connection relay exists in the emulator (the dashboard proxy forwards ARM requests only), so a rule has nothing to be checked in; engines are not relaunched after a gopherstack restart or snapshot restore; the automatic restart of a stopped server (7 days for PostgreSQL, 30 days for MySQL per the Learn how-to pages), maintenance windows, HA failover of the data plane, data encryption and Entra authentication are stored but not acted on.
  • AKS: machines (node pools are metadata, so a machine's resource id, IP addresses and name would be fabricated), private endpoint connections (a private endpoint cannot target a managed cluster because the private FQDN and DNS record layout of the API server is not published), managedNamespaces, identityBindings and rotateServiceAccountSigningKeys are not modelled (the generic store keeps what is PUT); node pool snapshots (Microsoft.ContainerService/snapshots) are modelled and a node pool or cluster profile can be created from one, but managedClusterSnapshots have no client in armcontainerservice v9.7.0 and stay in the generic store.
  • AKS: node pools are metadata; no VMs back them and the k3s engine runs one server node regardless of pool counts.
  • Container Apps: subPath mounts, NfsAzureFile volumes, additional TCP ports, exposedPort/TCP transport routing, session affinity (the replica pool in pkgs/gcpscale has no way to ask for a given replica), startup probes and tcpSocket probes are stored but not run or enforced (liveness and readiness httpGet probes run in the Container Instances engine) (the replicas run in the Container Instances engine and ingress is served on the ARM listener, so these are buildable); init containers run before the app containers and ingress ipSecurityRestrictions and corsPolicy are enforced; custom domains, the Dapr runtime and managed-identity registry pulls are stored but need DNS, a Dapr sidecar and an identity token endpoint the emulator does not have.
  • Container Apps: only the azure-servicebus and azure-queue (and azureQueue) KEDA scalers read in-process queues; cpu, memory, eventhubs, kafka, redis and other custom scalers are stored but never scale replicas (services/azureeventhubs and services/azureredis exist but are not read by the scaler). Scale-in relies on the pool idle timer (cooldownPeriod) rather than the 300 s scale-down stabilisation window.
  • Container Apps: getAuthtoken, listCustomHostNameAnalysis (its customDomainVerificationTest needs a real DNS lookup of the hostname) and diagnostics are not modelled (the generic store keeps what is PUT); authConfigs, sourcecontrols (no GitHub workflow is written), sessionPools (no sessions run), daprComponents, certificates and javaComponents are modelled but components, sessions and authentication run nothing, and the Key Vault certificate source is stored without being fetched.
  • Container Instances: the profile revision deregister action named in the Learn permissions list has no route in the 2025-09-01 spec read, so it is not modelled, and standby pools are not modelled (properties.standbyPoolProfile is rejected as an unknown property).
  • Network: VPN gateways, local network gateways, connections and ExpressRoute circuits with peerings and authorizations are modelled as control-plane resources (no tunnel or circuit state beyond Unknown/NotProvisioned); ExpressRoute ports, links, cross-connections, gateway connections of virtual WAN, VPN sites, point-to-site configuration and every other Microsoft.Network type not listed as modelled stay in the generic metadata-only store (Network Watcher children other than flow logs, such as packet captures and connection monitors, included). DDoS protection plans, private link services, route filters and rules, service endpoint policies and definitions, network watchers with flow logs and virtual network taps are modelled but no protection, mirroring, flow capture or private link traffic runs; the query/set flow log status operations are not modelled; private link service visibility is not enforced on private endpoint creation.
  • Application gateways: not modelled - backendSettingsCollection/listeners/routingRules (TCP/TLS proxy), loadDistributionPolicies, entraJWTValidationConfigs, privateLinkConfigurations and privateEndpointConnections (refused with 400), backendHealthOnDemand, available WAF rule sets/SSL options/server variables listings, per-child GET (the armnetwork clients expose none), subnet size sizing (a /24 is recommended, not enforced), NSG and route table requirements of the gateway subnet, Key Vault certificate fetch (keyVaultSecretId is stored, not resolved), user-assigned identity existence, and traffic: no listener serves requests, so request routing, WAF rules, rewrites and redirects are never executed. backendhealth probes only loopback IP backends.
  • Azure Firewalls: not modelled - AZFW_Hub / virtualHub firewalls (refused with 400), hubIPAddresses, the read-only ipGroups changeNumber list, packet capture, learned prefixes, DNAT/network/application traffic enforcement, threat intel allowlists enforcement, SNAT private ranges, DNS proxy, Premium TLS inspection/IDPS signatures/overrides, firewall policy drafts and deployments, the FQDN tags listing, the same-resource-group rule for firewall and virtual network, the Basic policy/firewall rule limits, and the maximum counts of rules, IP groups per firewall and addresses per IP group.
  • Network: load balancing is control plane only (no traffic distribution, probe execution, SNAT or health state); Basic SKU availability set / same-virtual-network membership rules, Gateway SKU tunnel interfaces and chaining, cross-region (Global tier) backend rules, frontend zones against public IP zones, NAT gateway zone and StandardV2 SKU (rejected), NAT gateway versus Basic public IP or Basic load balancer conflicts, IPv6 load balancer frontends and the privateEndpointNetworkPolicies NSG/UDR behaviour are not modelled or enforced.
  • Network: private endpoints ignore cross-subscription authorization (a target in another subscription yields Pending), support static addresses only through ipConfigurations with groupId/memberName matching the group id, write A records for every customDnsConfig FQDN into every zone of a zone group without matching the zone name, and omit the Cosmos mongoClusters, Application Gateway and other private-link target types.
  • Network: IPv6 public addresses come from 2001:db8::/32. Subnet addressing with ipamPoolPrefixAllocations and NAT/gateway-subnet rules are not enforced (NICs report the virtualMachine and primary back-references of an attached Compute VM but never hostedWorkloads).
  • Private DNS: overlapping-namespace conflicts and Microsoft.Network/dnszones (public DNS; armdns is not in go.mod) are not implemented.
  • Compute: shared and community galleries stay in the generic metadata-only store; not modelled on placement resources: dedicated host redeploy, hostSizes, capacity reservation sharing across subscriptions and block schedules, disk access private endpoint connections, Key Vault key existence for encryption sets and disk encryption set rotation.
  • Compute: unmanaged (vhd) disks, inline networkInterfaceConfigurations, boot diagnostics (retrieveBootDiagnosticsData needs console blobs no guest writes), maintenance (performMaintenance, since the emulator schedules no platform maintenance), capture (needs unmanaged VHD blobs, which are rejected) and convertToManagedDisks answer 501 NotImplemented or are rejected.
  • Compute: disks accept Empty, FromImage, Copy, CopyStart and Upload; Restore (needs Azure Backup recovery points; Microsoft.RecoveryServices is not modelled), UploadPreparedSecure, CopyFromSanSnapshot and Attach are rejected, beginGetAccess/endGetAccess answer 501 (no disk bytes exist behind an SAS URL; an Upload disk stays ReadyToUpload), and Ultra/Premium v2 IOPS limits, shared disks (maxShares), bursting, encryption sets and zone-versus-VM zone matching are stored but not enforced.
  • Compute: Uniform scale set instances do not get the public IP addresses of publicIPAddressConfiguration (accepted, not realised); autoscale (Microsoft.Insights/autoscalesettings stays in the generic store, and no metric feeds rules); rolling upgrades complete synchronously, so batch sizing, pauseTimeBetweenBatches, health gating and maxSurge are recorded in the policy but not run; the instance-level update changes tags, protectionPolicy, licenseType, userData, diagnosticsProfile and additionalCapabilities, and other changed properties are refused.
  • ManagedIdentity: isolationScope is stored and echoed but never enforced; listAssociatedResources scans Compute, Web, Container Instances, Container Apps and AKS resources only; resource group deletion removes same-named groups of identities in every subscription.
  • API Management: not modelled - gateways (self-hosted), portal, user subscriptions, wikis, issues, tenant settings, backup/restore, soft-delete/restore, custom hostnames, virtual networks, multi-region, private endpoints, v2 tiers (BasicV2, StandardV2) and the Isolated sku; they fall to 404 or are rejected. $top, $skip, count and nextLink paging work on the child lists; $filter is honoured on the APIs, API operations, product API, products, backends, named values (displayName only), tags, authorization servers, OpenID Connect providers, groups, users, subscriptions, loggers and policy fragment lists, and ignored on the other lists (the SDK documents no $filter for them).
  • API Management gateway: policies outside the subset (authentication-managed-identity, policy expressions beyond the documented subset, on-error for built-in pipeline errors such as a missing subscription key or an unmatched operation, rate-limit nested api/operation, forward-request http-version/continue-timeout/buffer-*/fail-on-error-status-code, cors terminate-unmatched-request) are refused at PUT or not honoured; the backend section runs set-header/set-query-parameter/set-backend-service/forward-request in order and a chain with no forward-request answers an empty 200. The cors policy page gives two defaults for terminate-unmatched-request (false in the attribute table, true in the usage notes), so unmatched simple requests proceed without CORS headers. set-header on Connection, Content-Length, Keep-Alive and Transfer-Encoding is accepted but those headers are never forwarded (Learn: they cannot be changed).
  • API Management gateway: HTTP (non-TLS) calls are impossible because the ARM listener is HTTPS, so an API whose protocols exclude https answers 404; the gateway has no client-certificate checks (validate-client-certificate, context.Request.Certificate); failed upstream calls answer 502 where the real gateway answers 500 (unverified); the unknown-host 404 body Resource not found and the 503 body of a service that is still activating are gopherstack wording, not documented.
  • Authorization: with --azure-arm-enforce-rbac, ARM requests under a resource group are evaluated against the bearer token's role assignments (action derived as {namespace}/{type}/{read|write|delete|action}); data planes, subscription-level and management-group requests are not evaluated; there is no deny-assignment API because only Blueprints, managed applications and similar services create deny assignments and none is emulated, so evaluation has no deny source; no PIM/eligibility/schedule, classic administrator or provider-operations API, no management-group scope for locks, and management group scopes are accepted but never checked to exist; managed-identity token endpoints do not exist, so a system-assigned identity cannot obtain a token to be evaluated.
  • Authorization: ScopeLocked enforcement covers the ARM listener only (not data planes, as documented); it does not model the documented exceptions where services act on locked resources, resource moves, or Microsoft.Authorization extension resources other than the lock itself inheriting a lock (role assignments and policy assignments do inherit it).
  • Authorization: role assignment conditions (ABAC) are stored and validated (conditionVersion 2.0, balanced brackets) but never evaluated, because evaluation needs the request attributes of the data plane that carries the attribute namespaces; delegatedManagedIdentityResourceId is stored; the last-owner deletion guard does not exist; assignableScopes of management groups are not checked to exist; list calls are not paged (no nextLink/$skipToken).
  • Policy: deny, audit, append and modify are evaluated at write time (PUT of a resource group or resource) for rules that read type, name, id, location, kind and tags with parameters(), concat() and field(); rules that read aliases, requestContext() or resourceGroup() are skipped, as are auditIfNotExists, deployIfNotExists and denyAction, so no remediation, policy versions, tokens or allowed-locations deny on aliased types exist; compliance states are recorded per resource and definition and persisted, but there is no Microsoft.PolicyInsights read API because armpolicyinsights is not in the module cache; exemptions are honoured; policyDefinitions is limited to a 13-definition and 1-initiative built-in catalog; initiative parameters are not checked against their member definitions; the Guest Configuration provider does not exist.
  • Authorization: management-group scoped policy assignments have no Terraform fixture (azurerm_management_group needs a tenant-level group API the emulator does not model); azurerm_role_definition, subscription policy assignments and policy set definitions are applied, planned clean and destroyed by TestTerraform_Azure_AuthorizationScoped, and test/terraform/azure/flexible_test.go and apim_test.go cover the Flexible Server and API Management resources named there.
  • Logic: not routed (answer 404 NotFound): workflows move and generateUpgradedDefinition, and every Integration Account and Integration Service Environment API.
  • Logic: only Request, Recurrence, Http polling and HttpWebhook triggers fire. SlidingWindow triggers are stored but never run (the Learn trigger reference has no section on it).
  • Logic expression functions: date formatting and parsing know 19 cultures (en-US, en-GB, fr-FR, es-ES, de-DE, it-IT, pt-BR, pt-PT, nl-NL, sv-SE, da-DK, nb-NO, fi-FI, pl-PL, ja-JP, zh-CN, ko-KR, ru-RU, tr-TR); other locales are rejected.
  • Logic: the Http action authenticates with Basic, Raw, ClientCertificate and ActiveDirectoryOAuth (Secret and Certificate credentials); ManagedServiceIdentity is rejected (the emulator has no managed-identity token endpoint the Logic provider can reuse).
Deferred
  • M7 initial implementation. No prior audit passes to report.
  • M9 added the Microsoft.ServiceBus RP (ServiceBusNamespaceCRUD/ServiceBusQueueTopicSubscriptionCRUD/ServiceBusAuthorizationRuleListKeys). QC pass over the pre-existing implementation found and fixed two real bugs before any Terraform run (List not filtering by resource group for queues/topics/subscriptions; DeleteResourcesInGroup's cascade delete never matching due to a double-pipe key-prefix bug) -- see AZURE.md section 10.10's M9 entry for full detail.
  • M9's first real-CI run (PR #2466, terraform-tests (6) job on Linux, past the macOS TLS-trust gap) surfaced a third real bug: classifyServiceBusPath had no case for namespaces/{ns}/networkRuleSets/default, which terraform-provider-azurerm's namespace Read calls unconditionally on every namespace regardless of SKU or config -- see ops.ServiceBusNamespaceNetworkRuleSet above and AZURE.md section 10.10's M9 entry for full detail. Checked queue/topic/subscription/authorizationRule Read functions in the same pinned source for the same class of unconditional sub-resource probe; none exists (each Read function only calls its own client.Get).

More

Documentation ¶

Index ¶

Constants ¶

View Source
const (
	FunctionHostKeyTypeFunction = "functionKeys"
	FunctionHostKeyTypeSystem   = "systemKeys"
)

Host key collections ARM addresses as host/default/{keyType}.

View Source
const (
	ACIEngineAuto = "auto"
	ACIEngineNone = "none"
)

ACIEngineAuto runs container groups in the container runtime; ACIEngineNone fails them to provision.

View Source
const (
	AKSEngineStub   = "stub"
	AKSEngineDocker = "docker"
)

AKSEngineStub keeps managed clusters as ARM state; AKSEngineDocker runs each as a k3s container.

View Source
const (
	DBEngineStub   = "stub"
	DBEngineDocker = "docker"
)

DBEngineStub keeps flexible servers as ARM state; DBEngineDocker runs each as a real postgres or mysql container.

View Source
const (
	DefaultEventHubPort     = 10005
	DefaultEventHubAMQPPort = 5673
)

DefaultEventHubPort and DefaultEventHubAMQPPort are the Event Hubs REST and AMQP ports ARM advertises; they must equal services/azureeventhubs's defaults.

View Source
const DefaultAppConfigPort = 10008

DefaultAppConfigPort is the App Configuration data plane's HTTPS port ARM advertises; it must equal services/azureappconfig.DefaultPort.

View Source
const DefaultClientID = "00000000-0000-0000-0000-000000000000"

DefaultClientID is the fixed dev client (application) ID.

View Source
const DefaultClientSecret = "gopherstack"

DefaultClientSecret is the fixed dev client secret accepted by the token endpoint when validation is off (the default).

View Source
const DefaultContainerRegistryPort = 10011

DefaultContainerRegistryPort is the Container Registry data plane's port ARM advertises in loginServer; it must equal services/azurecontainerregistry.DefaultPort.

View Source
const DefaultCosmosDBPort = 8081

DefaultCosmosDBPort is the Cosmos DB data plane's default port, used for documentEndpoint when no data-plane adapter is wired; it must equal services/cosmosdb.DefaultPort.

View Source
const DefaultEnvironmentName = "gopherstack"

DefaultEnvironmentName is the environment name advertised by the metadata document; must equal the Terraform provider's own `environment` setting.

View Source
const DefaultEventGridPort = 10007

DefaultEventGridPort is the Event Grid data plane's HTTPS port ARM advertises; it must equal services/azureeventgrid.DefaultPort.

View Source
const DefaultGraphPort = 10014

DefaultGraphPort is the Microsoft Graph listener's HTTPS port ARM advertises as the environment's Graph endpoint; it must equal services/azuregraph.DefaultPort.

View Source
const DefaultKeyVaultPort = 10004

DefaultKeyVaultPort is the default port ARM's Microsoft.KeyVault RP advertises in vaultUri; it must equal services/azurekeyvault.DefaultPort.

View Source
const DefaultLocation = "local"

DefaultLocation is the default Azure "location" value used when a request doesn't specify one.

View Source
const DefaultPort = 10006

DefaultPort is the fixed TCP port for the dedicated ARM listener. It sits inside --port-range-start/--port-range-end's default range (10000-10100) and leaves Key Vault (10004, M11) and App Configuration (10005, M12) untouched -- see AZURE.md section 10.7.

View Source
const DefaultSearchPort = 10015

DefaultSearchPort is the Azure AI Search data plane's HTTPS port ARM advertises.

View Source
const DefaultServiceBusPort = 10003

DefaultServiceBusPort is the default port ARM's Microsoft.ServiceBus RP advertises as serviceBusEndpoint (AZURE.md section 10.10's M9 entry). Mirrors DefaultStorageVHostPort's rationale for duplicating rather than importing services/azureservicebus.DefaultPort: this package has no other reason to depend on that package (rp_servicebus.go delegates through the narrow ServiceBusEntities interface, not a direct import), and importing it just for one int constant would be a needless coupling.

View Source
const DefaultStorageVHostPort = 10010

DefaultStorageVHostPort is the default port ARM's Microsoft.Storage RP advertises in primaryEndpoints (AZURE.md section 10.4/10.8). This intentionally duplicates services/azurestoragevhost.DefaultPort as a literal constant rather than importing that package: services/azurearm has no other reason to depend on it (no delegation happens here, see rp_storage.go), and importing a package just for one int constant would be a needless coupling for a documented, stable port number. Unlike the three separate per-service ports this replaced, there is only one port now: terraform-provider-azurerm's data-plane SDK requires Blob/Queue/Table to share a single domain suffix, which (since Go's url.URL.Host always includes the port) forces them onto a single shared port too -- see services/azurestoragevhost's package doc comment for the full derivation.

View Source
const DefaultSubscriptionID = "00000000-0000-0000-0000-000000000000"

DefaultSubscriptionID is the fixed dev subscription ID.

View Source
const DefaultTenantID = "00000000-0000-0000-0000-000000000000"

DefaultTenantID is the fixed dev AAD tenant ID. It, DefaultSubscriptionID, and DefaultClientID are all-zeros GUIDs, matching LocalStack's own Azure emulator convention: valid GUIDs (azurerm parses subscription_id/tenant_id as GUIDs) that are obviously not real Azure identifiers. See AZURE.md section 10.5.

Variables ¶

View Source
var (
	ErrACIGroupNotFound     = errors.New("azurearm: container group not found")
	ErrACIContainerNotFound = errors.New("azurearm: container not found in the group")

	ErrACINotRunning = errors.New("azurearm: container has no logs: never started, or the group is stopped")
)

Sentinel errors returned by the engine.

View Source
var (
	ErrInvalidResourceID      = errors.New("azurearm: invalid resource ID")
	ErrResourceGroupNotFound  = errors.New("azurearm: resource group not found")
	ErrResourceNotFound       = errors.New("azurearm: resource not found")
	ErrSubscriptionNotFound   = errors.New("azurearm: subscription not found")
	ErrProviderNotFound       = errors.New("azurearm: resource provider not found")
	ErrInvalidRequestBody     = errors.New("azurearm: invalid request body")
	ErrStorageAccountNotFound = errors.New("azurearm: storage account not found")

	ErrServiceBusNamespaceNotFound    = errors.New("azurearm: service bus namespace not found")
	ErrServiceBusQueueNotFound        = errors.New("azurearm: service bus queue not found")
	ErrServiceBusTopicNotFound        = errors.New("azurearm: service bus topic not found")
	ErrServiceBusSubscriptionNotFound = errors.New("azurearm: service bus subscription not found")

	ErrKeyVaultNotFound = errors.New("azurearm: key vault not found")

	ErrEventHubNamespaceNotFound     = errors.New("azurearm: event hubs namespace not found")
	ErrEventHubNotFound              = errors.New("azurearm: event hub not found")
	ErrEventHubConsumerGroupNotFound = errors.New("azurearm: event hubs consumer group not found")
	ErrEventHubRuleNotFound          = errors.New("azurearm: event hubs authorization rule not found")

	ErrEventGridTopicNotFound          = errors.New("azurearm: event grid topic not found")
	ErrEventGridSubscriptionNotFound   = errors.New("azurearm: event subscription not found")
	ErrEventGridNamespaceNotFound      = errors.New("azurearm: event grid namespace not found")
	ErrEventGridNamespaceTopicNotFound = errors.New("azurearm: event grid namespace topic not found")
	ErrEventGridDomainNotFound         = errors.New("azurearm: event grid domain not found")
	ErrEventGridDomainTopicNotFound    = errors.New("azurearm: event grid domain topic not found")
	ErrEventGridUnavailable            = errors.New("azurearm: event grid data plane is not available")

	ErrAppConfigStoreNotFound    = errors.New("azurearm: app configuration store not found")
	ErrAppConfigKeyValueNotFound = errors.New("azurearm: app configuration key-value not found")
	ErrAppConfigReplicaNotFound  = errors.New("azurearm: app configuration replica not found")
	ErrAppConfigDeletedNotFound  = errors.New("azurearm: deleted app configuration store not found")
	ErrAppConfigKeyLocked        = errors.New("azurearm: app configuration key-value is read-only")
	ErrAppConfigNameTaken        = errors.New("azurearm: app configuration store name is already in use")
	ErrAppConfigSoftDeleted      = errors.New("azurearm: app configuration store name is soft-deleted")
	ErrAppConfigPurgeProtected   = errors.New("azurearm: app configuration store has purge protection enabled")
	ErrAppConfigUnavailable      = errors.New("azurearm: app configuration data plane is not available")

	ErrSearchServiceNotFound   = errors.New("azurearm: search service not found")
	ErrSearchNameTaken         = errors.New("azurearm: search service name is already in use")
	ErrSearchQueryKeyNotFound  = errors.New("azurearm: search query key not found")
	ErrSearchLinkNotFound      = errors.New("azurearm: search shared private link resource not found")
	ErrSearchInvalidConfig     = errors.New("azurearm: invalid search service configuration")
	ErrSearchUnavailable       = errors.New("azurearm: search data plane is not available")
	ErrSearchSKUImmutable      = errors.New("azurearm: search service sku cannot be changed")
	ErrSearchQueryKeyNameTaken = errors.New("azurearm: search query key name is already in use")

	ErrWebSiteNotFound         = errors.New("azurearm: web site not found")
	ErrWebPlanNotFound         = errors.New("azurearm: app service plan not found")
	ErrWebFunctionNotFound     = errors.New("azurearm: function not found")
	ErrWebFunctionInCode       = errors.New("azurearm: function is defined in code, not by a function.json file")
	ErrWebKeyNotFound          = errors.New("azurearm: function key not found")
	ErrWebConfigNotFound       = errors.New("azurearm: site configuration not found")
	ErrWebNameTaken            = errors.New("azurearm: site name is already in use")
	ErrWebPlanInUse            = errors.New("azurearm: app service plan still has sites")
	ErrWebUnsupportedKind      = errors.New("azurearm: only Linux web apps and function apps are supported")
	ErrWebInvalidSiteConfig    = errors.New("azurearm: invalid site configuration")
	ErrWebPlanNotLinux         = errors.New("azurearm: Linux app needs a Linux (reserved) plan")
	ErrWebNotFunctionApp       = errors.New("azurearm: operation is only valid for function apps")
	ErrWebInvalidKeyType       = errors.New("azurearm: key type must be functionKeys or systemKeys")
	ErrWebSwapPending          = errors.New("azurearm: slot is prepared for a swap")
	ErrWebSlotLimit            = errors.New("azurearm: deployment slot limit reached for the plan tier")
	ErrWebSlotName             = errors.New("azurearm: invalid deployment slot name")
	ErrWebSwapFailed           = errors.New("azurearm: slot swap failed")
	ErrWebFunctionsUnavailable = errors.New("azurearm: azure functions data plane is not available")

	ErrACRRegistryNotFound      = errors.New("azurearm: container registry not found")
	ErrACRReplicationNotFound   = errors.New("azurearm: container registry replication not found")
	ErrACRWebhookNotFound       = errors.New("azurearm: container registry webhook not found")
	ErrACRNameTaken             = errors.New("azurearm: container registry name is already in use")
	ErrACRAdminDisabled         = errors.New("azurearm: container registry admin user is not enabled")
	ErrACRInvalidSKU            = errors.New("azurearm: container registry sku name must be Basic, Standard or Premium")
	ErrACRPremiumRequired       = errors.New("azurearm: georeplication requires a Premium registry")
	ErrACRInvalidCredential     = errors.New("azurearm: credential name must be password or password2")
	ErrACRUnavailable           = errors.New("azurearm: container registry data plane is not available")
	ErrACRScopeMapNotFound      = errors.New("azurearm: container registry scope map not found")
	ErrACRTokenNotFound         = errors.New("azurearm: container registry token not found")
	ErrACRScopeMapInUse         = errors.New("azurearm: container registry scope map is used by a token")
	ErrACRCacheRuleNotFound     = errors.New("azurearm: container registry cache rule not found")
	ErrACRCredentialSetNotFound = errors.New("azurearm: container registry credential set not found")
	ErrACRCredentialSetInUse    = errors.New("azurearm: container registry credential set is used by a cache rule")
	ErrACRImportNotFound        = errors.New("azurearm: container registry import source not found")
	ErrACRImportTagExists       = errors.New("azurearm: container registry import target tag already exists")
	ErrACRScopeMapReadOnly      = errors.New("azurearm: system scope maps cannot be modified")

	ErrCosmosAccountNotFound    = errors.New("azurearm: cosmos db account not found")
	ErrCosmosDatabaseNotFound   = errors.New("azurearm: cosmos db database not found")
	ErrCosmosContainerNotFound  = errors.New("azurearm: cosmos db container not found")
	ErrCosmosThroughputNotFound = errors.New("azurearm: cosmos db throughput settings not found")
	ErrCosmosConflict           = errors.New("azurearm: cosmos db resource conflict")
	ErrCosmosBadRequest         = errors.New("azurearm: cosmos db invalid request")
	ErrCosmosUnavailable        = errors.New("azurearm: cosmos db data plane unavailable")

	ErrDeletedVaultNotFound = errors.New("azurearm: deleted key vault not found")
	ErrVaultPurgeProtected  = errors.New("azurearm: key vault has purge protection enabled")

	// ErrSnapshotResourceGroupNull/ErrSnapshotResourceNull are returned by
	// Restore when a persisted snapshot's map holds a JSON null entry, which
	// decodes to a nil pointer that would panic on first dereference if
	// stored as-is (same class of bug services/cosmosdb's persistence.go
	// guards against).
	ErrSnapshotResourceGroupNull = errors.New("azurearm: restore snapshot: resource group is null")
	ErrSnapshotResourceNull      = errors.New("azurearm: restore snapshot: resource is null")
)

Sentinel errors for Azure Resource Manager (ARM) emulation. Mapped to ARM error codes/HTTP statuses in the errorDetails table (handler.go), modeled on services/sqs's errorDetails pattern.

View Source
var (
	ErrLogicWorkflowNotFound = errors.New("azurearm: logic workflow not found")
	ErrLogicTriggerNotFound  = errors.New("azurearm: logic trigger not found")
	ErrLogicRunNotFound      = errors.New("azurearm: logic run not found")
	ErrLogicActionNotFound   = errors.New("azurearm: logic run action not found")
	ErrLogicRepNotFound      = errors.New("azurearm: logic run action repetition not found")
	ErrLogicHistoryNotFound  = errors.New("azurearm: logic trigger history not found")
	ErrLogicVersionNotFound  = errors.New("azurearm: logic workflow version not found")
	ErrLogicRequestNotFound  = errors.New("azurearm: logic request history not found")
	ErrLogicOperationMissing = errors.New("azurearm: logic run operation not found")
	ErrLogicExpr             = errors.New("logic expression error")
)

Sentinels for the Microsoft.Logic resource provider.

View Source
var (
	ErrRedisNotFound                 = errors.New("azurearm: redis cache not found")
	ErrRedisFirewallNotFound         = errors.New("azurearm: redis firewall rule not found")
	ErrRedisPatchNotFound            = errors.New("azurearm: redis patch schedule not found")
	ErrRedisLinkedNotFound           = errors.New("azurearm: redis linked server not found")
	ErrRedisAccessPolicyNotFound     = errors.New("azurearm: redis access policy not found")
	ErrRedisAccessAssignmentNotFound = errors.New("azurearm: redis access policy assignment not found")
	ErrRedisNameTaken                = errors.New("azurearm: redis cache name is already in use")
	ErrRedisInvalid                  = errors.New("azurearm: invalid redis request")
	ErrRedisUnavailable              = errors.New("azurearm: redis data plane is not available")
)

Sentinel errors of the Microsoft.Cache provider.

View Source
var (
	ErrSQLServerNotFound   = errors.New("azurearm: sql server not found")
	ErrSQLChildNotFound    = errors.New("azurearm: sql resource not found")
	ErrSQLNameTaken        = errors.New("azurearm: sql server name is already in use")
	ErrSQLInvalid          = errors.New("azurearm: invalid sql request")
	ErrSQLPasswordNotValid = errors.New("azurearm: sql password does not meet the policy")
	ErrSQLEngine           = errors.New("azurearm: sql engine failure")
	ErrSQLConflict         = errors.New("azurearm: sql resource is in use")
)

Sentinel errors of the Microsoft.Sql provider.

View Source
var (
	ErrEventHubDRNotFound = errors.New("azurearm: event hubs disaster recovery configuration not found")
	ErrEventHubAliasInUse = errors.New("azurearm: event hubs alias is already in use")
	ErrEventHubDRInvalid  = errors.New("azurearm: invalid event hubs disaster recovery request")
)
View Source
var ErrAPIMDestinationNotPermitted = errors.New(
	"azurearm: apim backend is outside loopback and external backends are not allowed",
)

ErrAPIMDestinationNotPermitted is returned by the gateway's dialer for a backend outside loopback.

View Source
var ErrDiskBlobDenied = errors.New("disk blob access denied")

ErrDiskBlobDenied is returned by DiskBlobs when the Blob service would refuse the read.

View Source
var ErrDiskBlobNotFound = errors.New("disk blob not found")

ErrDiskBlobNotFound is returned by DiskBlobs for a missing container or blob.

View Source
var ErrGraphPortMismatch = errors.New("azurearm: --azure-arm-graph-port must match --azure-graph-port")

ErrGraphPortMismatch is returned when Settings.GraphPort (what ARM advertises as the Graph endpoint) disagrees with the Microsoft Graph listener's own port.

View Source
var ErrKeyVaultPortMismatch = errors.New(
	"azurearm: --azure-arm-keyvault-port must match --azure-keyvault-port",
)

ErrKeyVaultPortMismatch is returned when Settings.KeyVaultPort (what ARM advertises in vaultUri) disagrees with the Key Vault listener's own port.

View Source
var ErrLogicDestinationNotPermitted = errors.New(
	"the HTTP action may only reach loopback hosts unless --azure-arm-logic-allow-external is set")

ErrLogicDestinationNotPermitted is returned by the HTTP action's dialer for a host outside loopback.

View Source
var ErrMonitorUnavailable = &MonitorError{
	Code: redisCodeUnavailable, Message: "The Azure Monitor Logs data plane is not available.",
	Status: http.StatusServiceUnavailable,
}

ErrMonitorUnavailable is returned when no Azure Monitor Logs data plane is wired.

View Source
var ErrNilAppContext = errors.New("azurearm: nil app context")

ErrNilAppContext is returned when Init is called with a nil AppContext.

View Source
var ErrServiceBusPortMismatch = errors.New(
	"azurearm: --azure-arm-servicebus-port must match --azure-servicebus-port",
)

ErrServiceBusPortMismatch is returned when Settings.ServiceBusPort (what ARM advertises as serviceBusEndpoint) disagrees with the actual services/azureservicebus listener's own configured port -- the same fail-fast rationale as ErrStorageVHostPortMismatch.

View Source
var ErrStorageVHostPortMismatch = errors.New(
	"azurearm: --azure-arm-storage-vhost-port must match --azure-storage-vhost-port",
)

ErrStorageVHostPortMismatch is returned when Settings.StorageVHostPort (what ARM advertises in primaryEndpoints) disagrees with the actual services/azurestoragevhost listener's own configured port. Failing fast here, rather than letting the two silently diverge, avoids repeating the exact "advertised a port nothing answers on" bug class already found and fixed twice in this milestone (AZURE.md section 10.10, M8 bugs (1)/(5)).

Functions ¶

func ExtensionImage ¶

func ExtensionImage(sub, loc, publisher, typ, version string) (map[string]any, bool)

ExtensionImage returns one extension image; ok is false when the type or version is not offered.

func ExtensionImageTypes ¶

func ExtensionImageTypes(sub, loc, publisher string) []any

ExtensionImageTypes lists the extension types a publisher offers in a location.

func ExtensionImageVersions ¶

func ExtensionImageVersions(sub, loc, publisher, typ string) ([]any, bool)

ExtensionImageVersions lists the versions of one extension type; ok is false for an unknown type.

func ProviderBody ¶

func ProviderBody(subscriptionID, namespace, registrationState string, types []ResourceTypeDef) map[string]any

ProviderBody returns the wire response body for GET /subscriptions/{sub}/providers/{ns} and each entry of the GET /subscriptions/{sub}/providers list.

func RequestHostFromContext ¶

func RequestHostFromContext(ctx context.Context) string

RequestHostFromContext returns the host stashed by WithRequestHost, or "" if none was set (e.g. a unit test calling a ResourceProvider directly).

func ResourceSKUs ¶

func ResourceSKUs(location string) map[string]any

ResourceSKUs returns the skus listing for location.

func RunCommandDocs ¶

func RunCommandDocs() map[string]any

RunCommandDocs returns the location-scoped list of action run commands.

func SubscriptionBody ¶

func SubscriptionBody(subscriptionID, tenantID, displayName string) map[string]any

SubscriptionBody returns the wire response body for GET /subscriptions/{sub} and as the single entry of GET /subscriptions' "value" array. tenantID is a separate value from subscriptionID -- both default to the same fixed all-zeros GUID (AZURE.md section 10.5), but Settings allows overriding either independently, so this must not assume they're equal.

func TenantBody ¶

func TenantBody(tenantID string) map[string]any

TenantBody returns the wire response body for one entry of GET /tenants' "value" array.

func VMSizes ¶

func VMSizes() map[string]any

VMSizes returns the sizes the location offers, as the vmSizes list endpoints do.

func WithRequestHost ¶

func WithRequestHost(ctx context.Context, host string) context.Context

WithRequestHost returns a copy of ctx carrying host (the ARM request's own Host header, hostname only, no port).

Types ¶

type ACAClock ¶

type ACAClock = gcpscale.Clock

ACAClock is the clock that drives scale-to-zero.

type ACAQueueMeters ¶

type ACAQueueMeters interface {
	// ServiceBusMessages counts the active messages of a queue, or of a topic subscription when queue is empty.
	ServiceBusMessages(queue, topic, subscription string) (int, error)
	// StorageQueueMessages is the approximate message count of a Storage queue.
	StorageQueueMessages(queue string) (int, error)
}

ACAQueueMeters reads the queue depths KEDA's azure-servicebus and azure-queue scalers poll.

type ACIContainerView ¶

type ACIContainerView struct {
	Prev     *ACIState
	Cur      ACIState
	Name     string
	Events   []ACIEvent
	Restarts int
}

ACIContainerView is a container's instanceView.

type ACICredential ¶

type ACICredential struct {
	Server   string
	Username string
	Password string
}

ACICredential is an imageRegistryCredentials entry.

type ACIEngine ¶

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

ACIEngine runs container groups in the container runtime.

func NewACIEngine ¶

func NewACIEngine(runtime func() (ACIRuntime, error), disabledReason string) *ACIEngine

NewACIEngine creates an engine; runtime nil makes every group fail with disabledReason (or a default reason).

func (*ACIEngine) Active ¶

func (e *ACIEngine) Active(key string) bool

Active reports whether the group has a live (not stopped, not failed) run.

func (*ACIEngine) Close ¶

func (e *ACIEngine) Close()

Close stops every group and the engine.

func (*ACIEngine) Deploy ¶

func (e *ACIEngine) Deploy(cfg aciConfig)

Deploy (re)creates the group's containers and returns once each has started or failed. Failures are recorded on the group's view, not returned.

func (*ACIEngine) Logs ¶

func (e *ACIEngine) Logs(ctx context.Context, key, name string, tail int) (string, error)

Logs returns the container's logs, limited to the last tail lines when tail is positive.

func (*ACIEngine) Remove ¶

func (e *ACIEngine) Remove(key string)

Remove stops the group and forgets it.

func (*ACIEngine) RemoveAll ¶

func (e *ACIEngine) RemoveAll()

RemoveAll stops and forgets every group.

func (*ACIEngine) RemovePrefixed ¶

func (e *ACIEngine) RemovePrefixed(prefix string)

RemovePrefixed stops and forgets every group whose key starts with prefix.

func (*ACIEngine) RemoveUnprefixed ¶

func (e *ACIEngine) RemoveUnprefixed(prefix string)

RemoveUnprefixed stops and forgets every group whose key does not start with prefix.

func (*ACIEngine) Resumable ¶

func (e *ACIEngine) Resumable(key string) bool

Resumable reports whether the group is running or starting, so a restore should deploy it again.

func (*ACIEngine) SetFileShares ¶

func (e *ACIEngine) SetFileShares(s ACIFileShares)

SetFileShares wires the Azure Files seam used by azureFile volumes.

func (*ACIEngine) SetOnClose ¶

func (e *ACIEngine) SetOnClose(fn func())

SetOnClose registers a hook run by Close after every group is stopped.

func (*ACIEngine) SetPortPool ¶

func (e *ACIEngine) SetPortPool(p ACIPortPool)

SetPortPool wires the host port source for published ports.

func (*ACIEngine) SetProbeHooks ¶

func (e *ACIEngine) SetProbeHooks(
	pause func(ctx context.Context, d time.Duration) bool,
	httpProbe func(ctx context.Context, p ACIHTTPProbe) (int, error),
)

SetProbeHooks overrides how probes wait between attempts and issue HTTP requests; for tests. Nil keeps the default.

func (*ACIEngine) SetRuntime ¶

func (e *ACIEngine) SetRuntime(fn func() (ACIRuntime, error))

SetRuntime replaces the container runtime source; nil disables the engine.

func (*ACIEngine) SetTiming ¶

func (e *ACIEngine) SetTiming(backoff func(int) time.Duration, startup time.Duration)

SetTiming overrides the restart backoff and the startup bound; for tests and tuning.

func (*ACIEngine) Stop ¶

func (e *ACIEngine) Stop(key string)

Stop tears the group's containers down but keeps its record; later reads report Stopped.

func (*ACIEngine) View ¶

func (e *ACIEngine) View(key string) (ACIView, bool)

View returns the live state of the group.

type ACIEvent ¶

type ACIEvent struct {
	First   time.Time
	Last    time.Time
	Name    string
	Type    string
	Message string
	Count   int
}

ACIEvent is one entry of an instanceView events list.

type ACIExecRuntime ¶

type ACIExecRuntime interface {
	Exec(ctx context.Context, id string, cmd []string) (int, error)
}

ACIExecRuntime is implemented by runtimes that can run a command inside a container; exec probes need it.

type ACIFileShares ¶

type ACIFileShares interface {
	ExportShare(account, share string) (ACIShareTree, error)
	ApplyShare(account, share string, tree ACIShareTree) error
}

ACIFileShares is the seam azureFile volumes use to reach the Azure Files service. ExportShare must fail when the share does not exist.

type ACIFollowRuntime ¶

type ACIFollowRuntime interface {
	// FollowLogs writes the container's stdout and stderr to out until the container exits or ctx ends.
	FollowLogs(ctx context.Context, id string, out io.Writer) error
}

ACIFollowRuntime is implemented by runtimes that can follow a container's output while it runs.

type ACIHTTPProbe ¶

type ACIHTTPProbe struct {
	Headers http.Header
	URL     string
	Timeout time.Duration
}

ACIHTTPProbe is one HTTP probe request the engine asks its prober to make.

type ACIPortPool ¶

type ACIPortPool = gcpserve.PortPool

ACIPortPool hands out host ports for published container ports.

type ACIRuntime ¶

type ACIRuntime interface {
	// Pull fetches ref when it is absent or when cred is set; it reports whether a pull happened.
	Pull(ctx context.Context, ref string, cred *ACICredential) (bool, error)
	Start(ctx context.Context, spec container.Spec) (string, error)
	// Wait blocks until the container exits and returns its exit code.
	Wait(ctx context.Context, id string) (int, error)
	Logs(ctx context.Context, id, tail string) (string, error)
	Remove(ctx context.Context, id string) error
}

ACIRuntime is the slice of the container runtime that container groups need.

func NewDockerACIRuntime ¶

func NewDockerACIRuntime(r gcpserve.Runner) ACIRuntime

NewDockerACIRuntime wraps a pkgs/container runner.

type ACIShareTree ¶

type ACIShareTree struct {
	Files map[string][]byte
	Dirs  []string
}

ACIShareTree is the content of an Azure Files share: slash paths to file bytes, and directory paths.

type ACIState ¶

type ACIState struct {
	StartTime  *time.Time
	FinishTime *time.Time
	ExitCode   *int
	State      string
	Detail     string
}

ACIState is a container's currentState or previousState.

type ACIStdinExecRuntime ¶

type ACIStdinExecRuntime interface {
	ExecStdin(
		ctx context.Context, id string, cmd []string, stdin io.Reader, out io.Writer, term ACITerminalSize,
	) (int, error)
}

ACIStdinExecRuntime is implemented by runtimes that can relay standard input to an exec'd command.

type ACIStreamExecRuntime ¶

type ACIStreamExecRuntime interface {
	ExecStream(ctx context.Context, id string, cmd []string, out io.Writer) (int, error)
}

ACIStreamExecRuntime is implemented by runtimes that can run a command and stream its output.

type ACITerminalSize ¶

type ACITerminalSize struct{ Rows, Cols uint }

ACITerminalSize is the terminal an exec request asked for; the zero value means no terminal.

type ACIView ¶

type ACIView struct {
	HostPorts  map[int]int
	HostUDP    map[int]int
	Address    string
	State      string
	Failure    string
	Events     []ACIEvent
	Containers []ACIContainerView
	Inits      []ACIContainerView
}

ACIView is the live state of one container group.

type AKSEngineConfig ¶

type AKSEngineConfig struct {
	Runtime      k3sengine.Runtime
	Ports        *portalloc.Allocator
	Logger       *slog.Logger
	Probe        func(ctx context.Context, addr, token string) ([]byte, error)
	Host         string
	Token        string
	Image        string
	StartTimeout time.Duration
}

AKSEngineConfig configures docker-backed clusters: each running cluster is a single-node k3s container.

type APIMProvider ¶

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

APIMProvider implements ResourceProvider for Microsoft.ApiManagement/service and serves the gateway data plane.

func NewAPIMProvider ¶

func NewAPIMProvider() *APIMProvider

NewAPIMProvider creates an APIMProvider.

func (*APIMProvider) CheckName ¶

func (p *APIMProvider) CheckName(sub, name string) map[string]any

CheckName answers checkNameAvailability for a service name.

func (*APIMProvider) Close ¶

func (p *APIMProvider) Close()

Close cancels every open WebSocket session and in-flight one-way request and refuses new ones.

func (*APIMProvider) Delete ¶

func (p *APIMProvider) Delete(_ context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*APIMProvider) DeleteResourcesInGroup ¶

func (p *APIMProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*APIMProvider) Do ¶

func (p *APIMProvider) Do(req apimReq) (apimResp, error)

Do serves one control-plane request.

func (*APIMProvider) Get ¶

func (p *APIMProvider) Get(_ context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*APIMProvider) List ¶

func (p *APIMProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider.

func (*APIMProvider) ListKeys ¶

func (p *APIMProvider) ListKeys(context.Context, ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider; services have no listKeys action (subscriptions use listSecrets).

func (*APIMProvider) Namespace ¶

func (p *APIMProvider) Namespace() string

Namespace implements ResourceProvider.

func (*APIMProvider) Put ¶

func (p *APIMProvider) Put(_ context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*APIMProvider) Reset ¶

func (p *APIMProvider) Reset()

Reset implements ResourceProvider.

func (*APIMProvider) ResourceTypes ¶

func (p *APIMProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*APIMProvider) ServeGateway ¶

func (p *APIMProvider) ServeGateway(w http.ResponseWriter, r *http.Request) bool

ServeGateway answers a request addressed to a service's gateway (Host <name>.azure-api.net, or the path prefix /_apim/<name>/); it reports false for any other request.

func (*APIMProvider) SetActivation ¶

func (p *APIMProvider) SetActivation(consumption, classic time.Duration)

SetActivation sets how long Consumption and the other tiers stay in Activating or Updating.

func (*APIMProvider) SetAllowExternal ¶

func (p *APIMProvider) SetAllowExternal(allow bool)

SetAllowExternal lets gateway backends reach hosts outside loopback.

func (*APIMProvider) SetBackendRootCAs ¶

func (p *APIMProvider) SetBackendRootCAs(pool *x509.CertPool)

SetBackendRootCAs adds trust anchors for https backends; call it before the gateway serves traffic.

func (*APIMProvider) SetClock ¶

func (p *APIMProvider) SetClock(now func() time.Time)

SetClock replaces the provider's clock; provisioning and rate limits follow it.

type AppConfig ¶

type AppConfig interface {
	PutStore(name string) (time.Time, error)
	StoreCreated(name string) (time.Time, bool)
	DeleteStore(name string) error
	PurgeStore(name string)
	SetRevisionRetention(name string, days int) error
	StoreKeys(name string) ([]AppConfigKey, error)
	RegenerateStoreKey(name, keyID string) (AppConfigKey, error)

	PutKeyValue(store string, kv AppConfigKV) (AppConfigKV, error)
	GetKeyValue(store, key, label string) (AppConfigKV, bool)
	DeleteKeyValue(store, key, label string) error
	ListKeyValues(store string) ([]AppConfigKV, error)
}

AppConfig is the seam the Microsoft.AppConfiguration resource provider uses to keep the App Configuration data plane in step with ARM, so stores, access keys and key-values are shared between both planes.

type AppConfigEndpointConfig ¶

type AppConfigEndpointConfig struct {
	Override string
	Port     int
}

AppConfigEndpointConfig configures the endpoints the provider advertises.

type AppConfigKV ¶

type AppConfigKV struct {
	LastModified time.Time
	Value        *string
	ContentType  *string
	Tags         map[string]string
	Key          string
	Label        string
	ETag         string
	Locked       bool
}

AppConfigKV is a key-value as the ARM keyValues resources see it.

type AppConfigKey ¶

type AppConfigKey struct {
	LastModified time.Time
	ID           string
	Name         string
	Value        string
	ReadOnly     bool
}

AppConfigKey is one of a configuration store's access keys.

type AppConfigProvider ¶

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

AppConfigProvider implements ResourceProvider for Microsoft.AppConfiguration. ARM keeps location, tags, SKU and unmodelled properties; stores, access keys and key-values live in the data plane.

func NewAppConfigProvider ¶

func NewAppConfigProvider(cfg AppConfigEndpointConfig, dataPlane AppConfig) *AppConfigProvider

NewAppConfigProvider creates an AppConfigProvider; dataPlane may be nil.

func (*AppConfigProvider) CheckName ¶

func (p *AppConfigProvider) CheckName(_ context.Context, name string) map[string]any

CheckName reports whether a store name is available.

func (*AppConfigProvider) Delete ¶

Delete implements ResourceProvider.

func (*AppConfigProvider) DeleteResourcesInGroup ¶

func (p *AppConfigProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*AppConfigProvider) DeletedStore ¶

func (p *AppConfigProvider) DeletedStore(_ context.Context, location, name string) (map[string]any, error)

DeletedStore returns a soft-deleted store.

func (*AppConfigProvider) Get ¶

Get implements ResourceProvider.

func (*AppConfigProvider) KeyValue ¶

func (p *AppConfigProvider) KeyValue(_ context.Context, storeID ResourceID, key, label string) (map[string]any, error)

KeyValue serves POST .../listKeyValue: the key-value for the requested key and label.

func (*AppConfigProvider) List ¶

func (p *AppConfigProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider; only stores are listable here.

func (*AppConfigProvider) ListDeletedStores ¶

func (p *AppConfigProvider) ListDeletedStores(_ context.Context, subscription string) []map[string]any

ListDeletedStores lists the soft-deleted stores of a subscription.

func (*AppConfigProvider) ListKeyValues ¶

func (p *AppConfigProvider) ListKeyValues(_ context.Context, storeID ResourceID) ([]map[string]any, error)

ListKeyValues lists the key-values of the store addressed by storeID.

func (*AppConfigProvider) ListKeys ¶

func (p *AppConfigProvider) ListKeys(_ context.Context, id ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider for .../configurationStores/{name}/listKeys.

func (*AppConfigProvider) ListReplicas ¶

func (p *AppConfigProvider) ListReplicas(_ context.Context, storeID ResourceID) ([]map[string]any, error)

ListReplicas lists the replicas of the store addressed by storeID.

func (*AppConfigProvider) Namespace ¶

func (p *AppConfigProvider) Namespace() string

Namespace implements ResourceProvider.

func (*AppConfigProvider) PatchStore ¶

func (p *AppConfigProvider) PatchStore(
	_ context.Context, id ResourceID, body map[string]any,
) (map[string]any, error)

PatchStore applies a ConfigurationStoreUpdateParameters body (tags, sku, identity, properties).

func (*AppConfigProvider) PurgeDeletedStore ¶

func (p *AppConfigProvider) PurgeDeletedStore(_ context.Context, location, name string) error

PurgeDeletedStore permanently removes a soft-deleted store.

func (*AppConfigProvider) Put ¶

func (p *AppConfigProvider) Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*AppConfigProvider) RegenerateKey ¶

func (p *AppConfigProvider) RegenerateKey(_ context.Context, id ResourceID, keyID string) (map[string]any, error)

RegenerateKey replaces the access key with the given id and returns it.

func (*AppConfigProvider) ReplicaParent ¶

func (p *AppConfigProvider) ReplicaParent(label string) (string, bool)

ReplicaParent resolves a replica endpoint label ("<store>-<replica>") to the store it replicates.

func (*AppConfigProvider) Reset ¶

func (p *AppConfigProvider) Reset()

Reset implements ResourceProvider.

func (*AppConfigProvider) ResourceTypes ¶

func (p *AppConfigProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*AppConfigProvider) StoreSettings ¶

func (p *AppConfigProvider) StoreSettings(name string) (AppConfigStoreSettings, bool)

StoreSettings returns the SKU and public network access of the named configuration store.

type AppConfigStoreSettings ¶

type AppConfigStoreSettings struct {
	SKU                 string
	PublicNetworkAccess string
}

AppConfigStoreSettings are the ARM-held settings of a configuration store that the data plane honours.

type AssertionAuthenticator ¶

type AssertionAuthenticator interface {
	AuthenticateAssertion(clientID, assertion string, audiences []string) (objectID string, known bool, err error)
}

AssertionAuthenticator is implemented by a ClientAuthenticator that also verifies JWT client assertions (certificate and federated identity credential flows). audiences lists the aud values this endpoint accepts for a certificate assertion.

type AuthorizationProvider ¶

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

AuthorizationProvider implements ResourceProvider for Microsoft.Authorization: role definitions and assignments, management locks and policy definitions, set definitions and assignments. Requests are served from the scope-aware routes in rp_authorization_routes.go; the generic ResourceProvider methods exist for the provider registry only.

func NewAuthorizationProvider ¶

func NewAuthorizationProvider(tenantID string, msi *ManagedIdentityProvider) *AuthorizationProvider

NewAuthorizationProvider creates a provider with the built-in role and policy catalogs loaded. msi, when set, lets role assignments recognise managed identity principals.

func (*AuthorizationProvider) Allowed ¶

func (p *AuthorizationProvider) Allowed(principalID, resourceID, action string, data bool) bool

Allowed reports whether principalID holds a role assignment at or above resourceID whose role grants action (matched against dataActions when data is set, else actions), after notActions/notDataActions.

func (*AuthorizationProvider) Delete ¶

Delete implements ResourceProvider.

func (*AuthorizationProvider) DeleteResourcesInGroup ¶

func (p *AuthorizationProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider: locks, role assignments and policy assignments scoped to the group or to its resources go with it.

func (*AuthorizationProvider) Do ¶

func (p *AuthorizationProvider) Do(req authReq) (authResp, error)

Do serves one request.

func (*AuthorizationProvider) EvaluatePolicies ¶

func (p *AuthorizationProvider) EvaluatePolicies(res policyResource) PolicyOutcome

EvaluatePolicies evaluates every enforced policy assignment covering the resource against the write. Rules that read anything other than type, name, id, location, kind and tags (aliases, request context, resource group functions) are not evaluable and are skipped. Deny stops the evaluation; modify and append change the returned body; every evaluated definition leaves a compliance state.

func (*AuthorizationProvider) Get ¶

Get implements ResourceProvider.

func (*AuthorizationProvider) List ¶

List implements ResourceProvider.

func (*AuthorizationProvider) ListKeys ¶

ListKeys implements ResourceProvider.

func (*AuthorizationProvider) Namespace ¶

func (p *AuthorizationProvider) Namespace() string

Namespace implements ResourceProvider.

func (*AuthorizationProvider) PermissionsFor ¶

func (p *AuthorizationProvider) PermissionsFor(principalID, scope string) []any

PermissionsFor lists the permissions of the roles principalID holds at or above scope, one entry per distinct role.

func (*AuthorizationProvider) Put ¶

Put implements ResourceProvider; Microsoft.Authorization is served by the scope routes.

func (*AuthorizationProvider) RemoveUnder ¶

func (p *AuthorizationProvider) RemoveUnder(path string)

RemoveUnder drops locks, role assignments and policy assignments scoped to path or beneath it, after the resource at path was deleted.

func (*AuthorizationProvider) Reset ¶

func (p *AuthorizationProvider) Reset()

Reset implements ResourceProvider.

func (*AuthorizationProvider) ResourceTypes ¶

func (p *AuthorizationProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*AuthorizationProvider) SetPrincipalDirectory ¶

func (p *AuthorizationProvider) SetPrincipalDirectory(dir PrincipalDirectory, validate bool)

SetPrincipalDirectory sets the directory used to type and, when validate is set, verify principals.

func (*AuthorizationProvider) SetScopeChecker ¶

func (p *AuthorizationProvider) SetScopeChecker(subscriptionID string, rgExists func(name string) bool)

SetScopeChecker lets role definitions verify that their subscription and resource group assignable scopes exist.

type BlobProbe ¶

type BlobProbe struct {
	// Footer is the last vhdFooterSize bytes of a page blob (empty for other blob types).
	Footer   []byte
	Size     int64
	PageBlob bool
}

BlobProbe describes a blob in the Blob data plane.

type BlobRef ¶

type BlobRef struct {
	Account, Container, Blob, Query string
}

BlobRef addresses a blob by the URI an Import names; Query is the URI's raw query (a SAS token, if any).

type ClientAuthError ¶

type ClientAuthError struct {
	Name        string
	Description string
	Status      int
	Code        int
}

ClientAuthError is a token endpoint rejection rendered in Entra's error shape.

func (*ClientAuthError) Error ¶

func (e *ClientAuthError) Error() string

type ClientAuthenticator ¶

type ClientAuthenticator interface {
	AuthenticateClient(clientID, secret string) (objectID string, known bool, err error)
}

ClientAuthenticator checks client-credentials requests against a directory of registered applications. known is false for a client the directory does not know, which keeps the permissive dev-client behaviour.

type ComputeProvider ¶

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

ComputeProvider implements ResourceProvider for Microsoft.Compute. It is state only: no virtual machine runs. Lock order is compute then network; the network provider never calls back into compute.

func NewComputeProvider ¶

func NewComputeProvider(backend *InMemoryBackend, net *NetworkProvider, ids *identityService) *ComputeProvider

NewComputeProvider creates a provider that references NICs through net and identities through ids.

func (*ComputeProvider) AttachDetachDataDisks ¶

func (p *ComputeProvider) AttachDetachDataDisks(id ResourceID, body map[string]any) (map[string]any, error)

AttachDetachDataDisks applies a virtualMachines/{vm}/attachDetachDataDisks request (armcompute v9 AttachDetachDataDisksRequest) and returns the resulting storageProfile.

func (*ComputeProvider) Delete ¶

func (p *ComputeProvider) Delete(_ context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*ComputeProvider) DeleteResourcesInGroup ¶

func (p *ComputeProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider; network interfaces of removed machines are detached.

func (*ComputeProvider) GallerySharingUpdate ¶

func (p *ComputeProvider) GallerySharingUpdate(id ResourceID, body map[string]any) (map[string]any, error)

GallerySharingUpdate applies a sharing profile update (Add, Remove, Reset, EnableCommunity) to a gallery.

func (*ComputeProvider) GenerateSSHKeyPair ¶

func (p *ComputeProvider) GenerateSSHKeyPair(id ResourceID, encryption string) (map[string]any, error)

GenerateSSHKeyPair fills an SSH public key resource that has no key yet and returns the key pair.

func (*ComputeProvider) Get ¶

func (p *ComputeProvider) Get(_ context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*ComputeProvider) GetExpanded ¶

func (p *ComputeProvider) GetExpanded(id ResourceID) (map[string]any, error)

GetExpanded returns the resource with its instance view, as GET with $expand=instanceView does.

func (*ComputeProvider) GetKidExpanded ¶

func (p *ComputeProvider) GetKidExpanded(id ResourceID, expand string) (map[string]any, error)

GetKidExpanded serves GET on a child resource with a $expand option.

func (*ComputeProvider) HostRestart ¶

func (p *ComputeProvider) HostRestart(id ResourceID) error

HostRestart restarts the dedicated host, which restarts the running virtual machines placed on it.

func (*ComputeProvider) InstanceView ¶

func (p *ComputeProvider) InstanceView(id ResourceID) (map[string]any, error)

InstanceView returns the virtualMachines/{name}/instanceView document.

func (*ComputeProvider) List ¶

func (p *ComputeProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider.

func (*ComputeProvider) ListKeys ¶

func (p *ComputeProvider) ListKeys(context.Context, ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider.

func (*ComputeProvider) Namespace ¶

func (p *ComputeProvider) Namespace() string

Namespace implements ResourceProvider.

func (*ComputeProvider) PatchResource ¶

func (p *ComputeProvider) PatchResource(id ResourceID, body map[string]any) (map[string]any, error)

PatchResource applies an Update (PATCH): tags, identity and properties replace what the body names.

func (*ComputeProvider) PatchTags ¶

func (p *ComputeProvider) PatchTags(id ResourceID, tags map[string]string) (map[string]any, error)

PatchTags replaces the tags of a resource.

func (*ComputeProvider) Put ¶

func (p *ComputeProvider) Put(_ context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*ComputeProvider) Reset ¶

func (p *ComputeProvider) Reset()

Reset implements ResourceProvider.

func (*ComputeProvider) ResourceTypes ¶

func (p *ComputeProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*ComputeProvider) RollingUpgradeCancel ¶

func (p *ComputeProvider) RollingUpgradeCancel(id ResourceID) error

RollingUpgradeCancel cancels the running rolling upgrade; upgrades finish before the call returns, so there is never one to cancel and the answer is a conflict.

func (*ComputeProvider) RollingUpgradeLatest ¶

func (p *ComputeProvider) RollingUpgradeLatest(id ResourceID) (map[string]any, error)

RollingUpgradeLatest returns the status of the most recent rolling upgrade of the scale set.

func (*ComputeProvider) RunCommand ¶

func (p *ComputeProvider) RunCommand(id ResourceID, body map[string]any) error

RunCommand validates an action run command. No VM agent runs in the emulator, so a valid command on a running machine is refused instead of being given a fabricated result.

func (*ComputeProvider) VMAction ¶

func (p *ComputeProvider) VMAction(id ResourceID, action string) error

VMAction runs start, powerOff, restart, deallocate, redeploy or generalize against a stored virtual machine.

func (*ComputeProvider) VMSSAction ¶

func (p *ComputeProvider) VMSSAction(id ResourceID, action string, ids []string) error

VMSSAction runs manualupgrade, start, powerOff, restart, deallocate or delete against a scale set's instances; an empty ids list means every instance.

func (*ComputeProvider) VMSSInstanceAction ¶

func (p *ComputeProvider) VMSSInstanceAction(id ResourceID, action string) error

VMSSInstanceAction runs start, restart, powerOff, deallocate, redeploy, reimage or reimageall on one instance.

func (*ComputeProvider) VMSSInstancePatch ¶

func (p *ComputeProvider) VMSSInstancePatch(id ResourceID, body map[string]any) (map[string]any, error)

VMSSInstancePatch applies a PATCH to one Uniform scale set instance.

type ConfigProvider ¶

type ConfigProvider interface {
	GetAzureARMSettings() Settings
}

ConfigProvider is a private interface to extract ARM configuration from the abstract AppContext Config, mirroring services/cosmosdb.ConfigProvider.

type ContainerAppsProvider ¶

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

ContainerAppsProvider implements ResourceProvider for Microsoft.App. ARM keeps the configuration; revisions run as replicas in the container engine shared with Container Instances.

func NewContainerAppsProvider ¶

func NewContainerAppsProvider(
	engine *ACIEngine, backend *InMemoryBackend, network *NetworkProvider, ids *identityService,
) *ContainerAppsProvider

NewContainerAppsProvider creates a provider that runs replicas in engine. backend serves the Microsoft.App types this provider does not model; network and ids may be nil.

func (*ContainerAppsProvider) Close ¶

func (p *ContainerAppsProvider) Close()

Close stops every replica.

func (*ContainerAppsProvider) Delete ¶

Delete implements ResourceProvider.

func (*ContainerAppsProvider) DeleteResourcesInGroup ¶

func (p *ContainerAppsProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*ContainerAppsProvider) Get ¶

Get implements ResourceProvider.

func (*ContainerAppsProvider) List ¶

List implements ResourceProvider.

func (*ContainerAppsProvider) ListKeys ¶

ListKeys implements ResourceProvider.

func (*ContainerAppsProvider) Namespace ¶

func (p *ContainerAppsProvider) Namespace() string

Namespace implements ResourceProvider.

func (*ContainerAppsProvider) PatchResource ¶

func (p *ContainerAppsProvider) PatchResource(id ResourceID, body map[string]any) (map[string]any, error)

PatchResource implements resourcePatcher for managed environments, container apps and jobs.

func (*ContainerAppsProvider) Put ¶

func (p *ContainerAppsProvider) Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*ContainerAppsProvider) Reset ¶

func (p *ContainerAppsProvider) Reset()

Reset implements ResourceProvider.

func (*ContainerAppsProvider) ResourceTypes ¶

func (p *ContainerAppsProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*ContainerAppsProvider) ServeIngress ¶

func (p *ContainerAppsProvider) ServeIngress(w http.ResponseWriter, r *http.Request) bool

ServeIngress proxies a request addressed to a container app host name; it reports false for any other host.

func (*ContainerAppsProvider) SetClock ¶

func (p *ContainerAppsProvider) SetClock(c ACAClock)

SetClock replaces the clock that drives scale-to-zero; for tests.

func (*ContainerAppsProvider) SetKeyVaultSecrets ¶

func (p *ContainerAppsProvider) SetKeyVaultSecrets(v KeyVaultSecrets)

SetKeyVaultSecrets wires the Key Vault used to resolve keyVaultUrl secrets.

func (*ContainerAppsProvider) SetQueueMeters ¶

func (p *ContainerAppsProvider) SetQueueMeters(m ACAQueueMeters)

SetQueueMeters wires the queue depths that KEDA queue scale rules poll.

func (*ContainerAppsProvider) SetTrafficPicker ¶

func (p *ContainerAppsProvider) SetTrafficPicker(fn func(n int) int)

SetTrafficPicker replaces the source of the 0..n-1 draw that splits traffic between revisions; for tests.

type ContainerInstanceProvider ¶

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

ContainerInstanceProvider implements ResourceProvider for Microsoft.ContainerInstance container groups. ARM keeps the configuration; the ACIEngine runs the containers.

func NewContainerInstanceProvider ¶

func NewContainerInstanceProvider(engine *ACIEngine) *ContainerInstanceProvider

NewContainerInstanceProvider creates a provider over engine.

func (*ContainerInstanceProvider) Action ¶

Action runs start, stop or restart on a group.

func (*ContainerInstanceProvider) Close ¶

func (p *ContainerInstanceProvider) Close()

Close stops every running group.

func (*ContainerInstanceProvider) Delete ¶

Delete implements ResourceProvider.

func (*ContainerInstanceProvider) DeleteResourcesInGroup ¶

func (p *ContainerInstanceProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*ContainerInstanceProvider) Engine ¶

func (p *ContainerInstanceProvider) Engine() *ACIEngine

Engine returns the execution engine.

func (*ContainerInstanceProvider) Get ¶

Get implements ResourceProvider.

func (*ContainerInstanceProvider) List ¶

List implements ResourceProvider.

func (*ContainerInstanceProvider) ListKeys ¶

ListKeys implements ResourceProvider.

func (*ContainerInstanceProvider) Logs ¶

func (p *ContainerInstanceProvider) Logs(
	ctx context.Context,
	id ResourceID,
	container string,
	tail int,
) (string, error)

Logs returns a container's logs.

func (*ContainerInstanceProvider) Namespace ¶

func (p *ContainerInstanceProvider) Namespace() string

Namespace implements ResourceProvider.

func (*ContainerInstanceProvider) NewExecSession ¶

func (p *ContainerInstanceProvider) NewExecSession(
	host string, id ResourceID, containerName, command string, attach bool, term ACITerminalSize,
) (string, string, error)

NewExecSession registers an exec or attach session for a started container and returns the websocket URI and the password the client sends first (armcontainerinstance ContainerExecResponse / ContainerAttachResponse).

func (*ContainerInstanceProvider) Patch ¶

func (p *ContainerInstanceProvider) Patch(
	_ context.Context,
	id ResourceID,
	body map[string]any,
) (map[string]any, error)

Patch replaces the group's tags.

func (*ContainerInstanceProvider) Put ¶

func (p *ContainerInstanceProvider) Put(_ context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider. It answers once the containers have started or failed to.

func (*ContainerInstanceProvider) Reset ¶

func (p *ContainerInstanceProvider) Reset()

Reset implements ResourceProvider.

func (*ContainerInstanceProvider) ResourceTypes ¶

func (p *ContainerInstanceProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*ContainerInstanceProvider) ServeExec ¶

ServeExec upgrades /_aci/exec/{token} to a websocket. Exec clients send the password first, attach clients send it as the Authorization header; the command's combined output is then streamed as binary frames and the socket closes with the command. Frames the client sends after that are the command's standard input.

type ContainerRegistries ¶

type ContainerRegistries interface {
	PutRegistry(name string, adminEnabled bool) (ContainerRegistryInfo, error)
	RegistryInfo(name string) (ContainerRegistryInfo, bool)
	DeleteRegistry(name string) error
	SetAnonymousPull(name string, enabled bool) error
	Credentials(name string) (ContainerRegistryCredentials, error)
	RegenerateCredential(name, which string) (ContainerRegistryCredentials, error)
	SetWebhook(registry string, w ContainerRegistryWebhook) error
	DeleteWebhook(registry, name string) error
	PingWebhook(registry, name string) (string, error)
	WebhookEvents(registry, name string) ([]map[string]any, error)
	ScopeMaps(registry string) ([]ContainerRegistryScopeMap, error)
	SetScopeMap(registry, name, description string, actions []string) error
	DeleteScopeMap(registry, name string) error
	Tokens(registry string) ([]ContainerRegistryToken, error)
	SetToken(registry, name, scopeMap string, enabled bool) error
	DeleteToken(registry, name string) error
	GenerateTokenPassword(registry, token, which string, expiry *time.Time) (ContainerRegistryTokenPassword, error)
	ImportImage(ctx context.Context, registry string, req ContainerRegistryImport) error
	SetNetworkRules(registry string, rules ContainerRegistryNetworkRules) error
	SetCacheRule(registry string, rule ContainerRegistryCacheRule) error
	DeleteCacheRule(registry, name string) error
	CredentialHealth(usernameSecretID, passwordSecretID string) (healthy bool, code, message string)
	CheckEncryptionKey(keyIdentifier string) error
	SetEncryptionKey(registry, keyIdentifier string) error
	SetExportAllowed(registry string, allowed bool) error
	UsedBytes(registry string) (int64, error)
}

ContainerRegistries is the seam the Microsoft.ContainerRegistry resource provider uses to keep the registry data plane in step with ARM. Primitive types only, so this package never imports the data-plane service.

type ContainerRegistryCacheCredentials ¶

type ContainerRegistryCacheCredentials struct {
	LoginServer    string
	UsernameSecret string
	PasswordSecret string
}

ContainerRegistryCacheCredentials locates a cache rule's upstream login in Key Vault.

type ContainerRegistryCacheRule ¶

type ContainerRegistryCacheRule struct {
	Credentials *ContainerRegistryCacheCredentials
	Name        string
	Source      string
	Target      string
}

ContainerRegistryCacheRule pulls Source into Target on first pull.

type ContainerRegistryCredentials ¶

type ContainerRegistryCredentials struct {
	Username  string
	Password  string
	Password2 string
}

ContainerRegistryCredentials are a registry's admin-user credentials.

type ContainerRegistryEndpointConfig ¶

type ContainerRegistryEndpointConfig struct {
	Override string
	Port     int
}

ContainerRegistryEndpointConfig configures the login server the provider advertises.

type ContainerRegistryImport ¶

type ContainerRegistryImport struct {
	SourceRegistry  string
	SourceURI       string
	SourceImage     string
	Username        string
	Password        string
	TargetTags      []string
	UntaggedTargets []string
	Force           bool
}

ContainerRegistryImport is an importImage request; SourceRegistry names an emulated registry, SourceURI an external one.

type ContainerRegistryInfo ¶

type ContainerRegistryInfo struct {
	CreatedAt    time.Time
	AdminEnabled bool
}

ContainerRegistryInfo is the data plane's view of a registry.

type ContainerRegistryNetworkRules ¶

type ContainerRegistryNetworkRules struct {
	Allow          []string
	PublicDisabled bool
	DefaultDeny    bool
}

ContainerRegistryNetworkRules is the public-endpoint firewall the data plane enforces.

type ContainerRegistryProvider ¶

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

ContainerRegistryProvider implements ResourceProvider for Microsoft.ContainerRegistry. ARM keeps location, tags, SKU, child resources and unmodelled properties; the registry, its admin flag and credentials live in the data plane.

func NewContainerRegistryProvider ¶

func NewContainerRegistryProvider(
	cfg ContainerRegistryEndpointConfig, dataPlane ContainerRegistries,
) *ContainerRegistryProvider

NewContainerRegistryProvider creates a ContainerRegistryProvider; dataPlane may be nil.

func (*ContainerRegistryProvider) CallbackConfig ¶

func (p *ContainerRegistryProvider) CallbackConfig(_ context.Context, id ResourceID) (map[string]any, error)

CallbackConfig answers POST .../webhooks/{name}/getCallbackConfig.

func (*ContainerRegistryProvider) CheckName ¶

func (p *ContainerRegistryProvider) CheckName(name string) map[string]any

CheckName answers POST .../checkNameAvailability.

func (*ContainerRegistryProvider) Delete ¶

Delete implements ResourceProvider.

func (*ContainerRegistryProvider) DeleteResourcesInGroup ¶

func (p *ContainerRegistryProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*ContainerRegistryProvider) GenerateCredentials ¶

func (p *ContainerRegistryProvider) GenerateCredentials(
	_ context.Context, id ResourceID, body map[string]any,
) (map[string]any, error)

GenerateCredentials answers POST .../generateCredentials: new passwords for a token, shown once.

func (*ContainerRegistryProvider) Get ¶

Get implements ResourceProvider.

func (*ContainerRegistryProvider) ImportImage ¶

func (p *ContainerRegistryProvider) ImportImage(
	ctx context.Context, id ResourceID, body map[string]any,
) (map[string]any, error)

ImportImage answers POST .../importImage.

func (*ContainerRegistryProvider) List ¶

List implements ResourceProvider; registries are listable at subscription and group scope.

func (*ContainerRegistryProvider) ListChildren ¶

func (p *ContainerRegistryProvider) ListChildren(id ResourceID, kind acrKind) ([]map[string]any, error)

ListChildren lists a registry's replications or webhooks.

func (*ContainerRegistryProvider) ListCredentials ¶

func (p *ContainerRegistryProvider) ListCredentials(_ context.Context, id ResourceID) (map[string]any, error)

ListCredentials answers POST .../listCredentials.

func (*ContainerRegistryProvider) ListKeys ¶

ListKeys is not applicable to registries; credentials come from ListCredentials.

func (*ContainerRegistryProvider) ListUsages ¶

func (p *ContainerRegistryProvider) ListUsages(_ context.Context, id ResourceID) (map[string]any, error)

ListUsages answers GET .../registries/{name}/listUsages: stored bytes and the counts of webhooks and, on Premium, replicas, IP rules and virtual network rules, with the SKU limits of Learn container-registry-skus.

func (*ContainerRegistryProvider) Namespace ¶

func (p *ContainerRegistryProvider) Namespace() string

Namespace implements ResourceProvider.

func (*ContainerRegistryProvider) Patch ¶

func (p *ContainerRegistryProvider) Patch(
	_ context.Context,
	id ResourceID,
	body map[string]any,
) (map[string]any, error)

Patch updates tags, SKU, identity and properties of a registry in place (ARM PATCH).

func (*ContainerRegistryProvider) PingWebhook ¶

func (p *ContainerRegistryProvider) PingWebhook(_ context.Context, id ResourceID) (map[string]any, error)

PingWebhook answers POST .../webhooks/{name}/ping with the id of the ping event it delivers.

func (*ContainerRegistryProvider) Put ¶

func (p *ContainerRegistryProvider) Put(
	ctx context.Context, id ResourceID, body map[string]any,
) (map[string]any, error)

Put implements ResourceProvider.

func (*ContainerRegistryProvider) RegenerateCredential ¶

func (p *ContainerRegistryProvider) RegenerateCredential(
	_ context.Context, id ResourceID, which string,
) (map[string]any, error)

RegenerateCredential answers POST .../regenerateCredential.

func (*ContainerRegistryProvider) Reset ¶

func (p *ContainerRegistryProvider) Reset()

Reset implements ResourceProvider.

func (*ContainerRegistryProvider) ResourceTypes ¶

func (p *ContainerRegistryProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*ContainerRegistryProvider) WebhookEvents ¶

func (p *ContainerRegistryProvider) WebhookEvents(_ context.Context, id ResourceID) (map[string]any, error)

WebhookEvents answers POST .../webhooks/{name}/listEvents.

type ContainerRegistryScopeMap ¶

type ContainerRegistryScopeMap struct {
	CreatedAt   time.Time
	Name        string
	Description string
	Actions     []string
	System      bool
}

ContainerRegistryScopeMap is a named set of repository permissions; System scope maps are read-only.

type ContainerRegistryToken ¶

type ContainerRegistryToken struct {
	CreatedAt time.Time
	Name      string
	ScopeMap  string
	Passwords []ContainerRegistryTokenPassword
	Enabled   bool
}

ContainerRegistryToken is a registry token with the metadata of its generated passwords.

type ContainerRegistryTokenPassword ¶

type ContainerRegistryTokenPassword struct {
	Created time.Time
	Expiry  *time.Time
	Name    string
	Value   string
}

ContainerRegistryTokenPassword is a token password; Value is set only when it has just been generated.

type ContainerRegistryWebhook ¶

type ContainerRegistryWebhook struct {
	Headers    map[string]string
	Name       string
	ServiceURI string
	Scope      string
	Status     string
	Actions    []string
}

ContainerRegistryWebhook is a registry webhook the data plane fires on image and chart pushes and deletes.

type ContainerServiceProvider ¶

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

ContainerServiceProvider implements ResourceProvider for Microsoft.ContainerService (AKS). ARM keeps the configuration; with the opt-in engine each running cluster is a single-node k3s container.

func NewContainerServiceProvider ¶

func NewContainerServiceProvider(
	backend *InMemoryBackend, network *NetworkProvider, ids *identityService,
) *ContainerServiceProvider

NewContainerServiceProvider creates the provider; network and ids may be nil.

func (*ContainerServiceProvider) Close ¶

func (p *ContainerServiceProvider) Close()

Close stops every cluster container.

func (*ContainerServiceProvider) Delete ¶

Delete implements ResourceProvider.

func (*ContainerServiceProvider) DeleteResourcesInGroup ¶

func (p *ContainerServiceProvider) DeleteResourcesInGroup(ctx context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider; clusters of the group go with their node resource groups, and a deleted node resource group takes its cluster.

func (*ContainerServiceProvider) EnableEngine ¶

func (p *ContainerServiceProvider) EnableEngine(cfg AKSEngineConfig) error

EnableEngine switches the provider to docker mode with an engine built from cfg.

func (*ContainerServiceProvider) Get ¶

Get implements ResourceProvider.

func (*ContainerServiceProvider) List ¶

List implements ResourceProvider.

func (*ContainerServiceProvider) ListKeys ¶

ListKeys implements ResourceProvider.

func (*ContainerServiceProvider) Namespace ¶

func (p *ContainerServiceProvider) Namespace() string

Namespace implements ResourceProvider.

func (*ContainerServiceProvider) PatchResource ¶

func (p *ContainerServiceProvider) PatchResource(id ResourceID, body map[string]any) (map[string]any, error)

PatchResource implements resourcePatcher: the Update Tags operation.

func (*ContainerServiceProvider) Put ¶

func (p *ContainerServiceProvider) Put(
	ctx context.Context,
	id ResourceID,
	body map[string]any,
) (map[string]any, error)

Put implements ResourceProvider.

func (*ContainerServiceProvider) Reset ¶

func (p *ContainerServiceProvider) Reset()

Reset implements ResourceProvider.

func (*ContainerServiceProvider) ResourceTypes ¶

func (p *ContainerServiceProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*ContainerServiceProvider) SetClock ¶

func (p *ContainerServiceProvider) SetClock(now func() time.Time)

SetClock replaces the provider's time source; call it before the provider serves requests.

func (*ContainerServiceProvider) SetEngineFactory ¶

func (p *ContainerServiceProvider) SetEngineFactory(fn func() (*k3sengine.Engine, error), image string)

SetEngineFactory enables docker mode with an engine built on first use, so the runtime is only dialed when a cluster is created.

func (*ContainerServiceProvider) SetResourceGroupCascade ¶

func (p *ContainerServiceProvider) SetResourceGroupCascade(fn func(ctx context.Context, resourceGroup string))

SetResourceGroupCascade sets the callback that deletes the resources of a resource group in every provider; it removes the contents of a cluster's node resource group.

type CosmosAccountPolicies ¶

type CosmosAccountPolicies struct {
	Consistency        string
	Backup             string
	MaxStalenessPrefix int64
	MaxIntervalSeconds int
	AutomaticFailover  bool
}

CosmosAccountPolicies are the account settings the data plane honours: the default consistency level (with its bounded-staleness limits), service-managed failover, and the backup mode ("Periodic", "Continuous7Days" or "Continuous30Days"). A data plane that models them implements CosmosPolicyResources.

type CosmosContainer ¶

type CosmosContainer struct {
	Modified                 time.Time
	DefaultTTL               *int
	ID                       string
	RID                      string
	PartitionKeyPaths        []string
	IndexingPolicy           []byte
	UniqueKeyPolicy          []byte
	ConflictResolutionPolicy []byte
}

CosmosContainer is a Cosmos DB container as the data plane reports it; the policy fields are raw JSON.

type CosmosDatabase ¶

type CosmosDatabase struct {
	Modified time.Time
	ID       string
	RID      string
}

CosmosDatabase is a Cosmos DB database as the data plane reports it.

type CosmosEndpointConfig ¶

type CosmosEndpointConfig struct {
	Override string
}

CosmosEndpointConfig configures how the DocumentDB provider advertises documentEndpoint.

type CosmosPolicyResources ¶

type CosmosPolicyResources interface {
	SetAccountPolicies(CosmosAccountPolicies)
}

CosmosPolicyResources is the optional seam for CosmosAccountPolicies.

type CosmosProvider ¶

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

CosmosProvider implements ResourceProvider for Microsoft.DocumentDB. Databases and containers live in the Cosmos DB data plane behind the CosmosResources seam; this provider keeps account metadata, ownership and the legacy throughput entries of snapshots written before offers moved to the data plane.

func NewCosmosProvider ¶

func NewCosmosProvider(cfg CosmosEndpointConfig, dataPlane CosmosResources) *CosmosProvider

NewCosmosProvider creates a CosmosProvider; dataPlane may be nil.

func (*CosmosProvider) ConnectionStrings ¶

func (p *CosmosProvider) ConnectionStrings(ctx context.Context, id ResourceID) (map[string]any, error)

ConnectionStrings serves the listConnectionStrings action.

func (*CosmosProvider) Delete ¶

func (p *CosmosProvider) Delete(_ context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*CosmosProvider) DeleteResourcesInGroup ¶

func (p *CosmosProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*CosmosProvider) FailoverPriorityChange ¶

func (p *CosmosProvider) FailoverPriorityChange(_ context.Context, id ResourceID, body map[string]any) error

FailoverPriorityChange applies a manual failover: the body must give every location exactly one unique priority, and the location with priority 0 becomes the write region.

func (*CosmosProvider) Get ¶

func (p *CosmosProvider) Get(ctx context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*CosmosProvider) List ¶

func (p *CosmosProvider) List(ctx context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider; id's Names holds the parent chain for child lists.

func (*CosmosProvider) ListKeys ¶

func (p *CosmosProvider) ListKeys(_ context.Context, id ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider.

func (*CosmosProvider) Namespace ¶

func (p *CosmosProvider) Namespace() string

Namespace implements ResourceProvider.

func (*CosmosProvider) Patch ¶

func (p *CosmosProvider) Patch(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Patch merges tags, identity and properties into an existing account.

func (*CosmosProvider) Put ¶

func (p *CosmosProvider) Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*CosmosProvider) ReadonlyKeys ¶

func (p *CosmosProvider) ReadonlyKeys(_ context.Context, id ResourceID) (map[string]any, error)

ReadonlyKeys serves the readonlykeys action.

func (*CosmosProvider) RegenerateKey ¶

func (p *CosmosProvider) RegenerateKey(_ context.Context, id ResourceID, kind string) error

RegenerateKey replaces one of the account's keys with a fresh random one the data plane authorizes.

func (*CosmosProvider) Reset ¶

func (p *CosmosProvider) Reset()

Reset implements ResourceProvider.

func (*CosmosProvider) ResourceTypes ¶

func (p *CosmosProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

type CosmosRegion ¶

type CosmosRegion struct {
	Name     string
	Priority int
}

CosmosRegion is one account location and its failover priority.

type CosmosResources ¶

type CosmosResources interface {
	// Endpoint reports the data-plane listener's port and whether it serves TLS.
	Endpoint() (port int, tls bool)
	// MasterKey is the data plane's configured master key.
	MasterKey() string
	// AcceptKey and RevokeKey manage extra keys the data plane authorizes.
	AcceptKey(key string)
	RevokeKey(key string)

	CreateDatabase(id string) (CosmosDatabase, error)
	GetDatabase(id string) (CosmosDatabase, error)
	ListDatabases() []CosmosDatabase
	DeleteDatabase(id string) error

	// PutContainer creates the container, or replaces its mutable settings when it already exists.
	PutContainer(db string, c CosmosContainer) (CosmosContainer, error)
	GetContainer(db, id string) (CosmosContainer, error)
	ListContainers(db string) ([]CosmosContainer, error)
	DeleteContainer(db, id string) error

	// GetThroughput reads the offer of a database (container == "") or container; ErrCosmosThroughputNotFound
	// when none is provisioned.
	GetThroughput(db, container string) (CosmosThroughput, error)
	// PutThroughput creates or replaces that offer.
	PutThroughput(db, container string, t CosmosThroughput) error

	// SetRegions publishes the account's regional topology (the lowest priority is the write region).
	SetRegions(regions []CosmosRegion, multiWrite bool)
}

CosmosResources is the seam the Microsoft.DocumentDB resource provider uses to reach the Cosmos DB data plane. Errors are the package's ErrCosmos* sentinels.

type CosmosThroughput ¶

type CosmosThroughput = cosmosThroughput

CosmosThroughput is a provisioned-throughput setting: manual RU/s or an autoscale maximum.

type DiskBlobs ¶

type DiskBlobs interface {
	ProbeBlob(ref BlobRef) (BlobProbe, error)
}

DiskBlobs reads blobs for disk and snapshot Import. Implementations must authorize the read as the Blob service would and must not call back into the ARM provider.

type DockerFlexConfig ¶

type DockerFlexConfig struct {
	// Runtime dials the container runtime on first use.
	Runtime      func() (container.Runtime, error)
	Ports        *portalloc.Allocator
	Logger       *slog.Logger
	Image        string
	StartTimeout time.Duration
}

DockerFlexConfig configures the docker engine: one postgres or mysql container per server.

type EnvironmentAuth ¶

type EnvironmentAuth struct {
	LoginEndpoint    string   `json:"loginEndpoint"`
	IdentityProvider string   `json:"identityProvider"`
	Tenant           string   `json:"tenant"`
	Audiences        []string `json:"audiences"`
}

EnvironmentAuth is EnvironmentDescriptor's "authentication" field.

Tenant must be the literal string "common", and IdentityProvider must be "AAD" -- not gopherstack's fixed tenant GUID. hashicorp/go-azure-sdk's Environment.IsAzureStack() (sdk/environments/azure_stack.go) treats any other combination as an Azure Stack environment, which terraform-provider-azurerm explicitly refuses to run against (internal/clients/builder.go: "does not support Azure Stack"). Real Azure's own AzurePublic() environment (sdk/environments/azure_public.go) hardcodes exactly these two values even though it obviously isn't single-tenant -- this is a control field for auth flow selection, not a place to plug in a real tenant ID.

type EnvironmentDescriptor ¶

type EnvironmentDescriptor struct {
	Suffixes                 EnvironmentSuffixes `json:"suffixes"`
	Gallery                  string              `json:"gallery"`
	Media                    string              `json:"media,omitempty"`
	Graph                    string              `json:"graph"`
	GraphAudience            string              `json:"graphAudience"`
	Name                     string              `json:"name"`
	ResourceManager          string              `json:"resourceManager"`
	ResourceManagerEndpoint  string              `json:"resourceManagerEndpoint"`
	ActiveDirectoryDataLake  string              `json:"activeDirectoryDataLake,omitempty"`
	SQLManagement            string              `json:"sqlManagement,omitempty"`
	Batch                    string              `json:"batch,omitempty"`
	Portal                   string              `json:"portal"`
	MicrosoftGraphResourceID string              `json:"microsoftGraphResourceId"`
	Authentication           EnvironmentAuth     `json:"authentication"`
}

EnvironmentDescriptor is the GET /metadata/endpoints response body: a SINGLE JSON object, not an array (see BuildMetadataEndpoints's doc comment for why this is non-obvious and easy to get backwards). Field set and semantics verified against hashicorp/go-azure-sdk's environments.FromEndpoint, which hard-fails on a document missing Name, ResourceManagerEndpoint, or MicrosoftGraphResourceID (AZURE.md section 10.8) -- every one of those three, plus every other field FromEndpoint reads, is populated below.

MicrosoftGraphResourceID is a TOP-LEVEL field ("microsoftGraphResourceId"), not nested under a "resourceIdentifiers" object -- verified against go-azure-sdk's sdk/internal/metadata/client.go's unexported metaDataResponse wire struct, which has no ResourceIdentifiers field at all. Nesting it silently zero-values the field on unmarshal (FromEndpoint then fails with "no `microsoftGraphResourceId` was returned").

func BuildMetadataEndpoints ¶

func BuildMetadataEndpoints(baseURL string, settings Settings) EnvironmentDescriptor

BuildMetadataEndpoints builds the GET /metadata/endpoints response body for settings.Environment, with every URL pointing back at baseURL (the ARM listener's own scheme://host:port, e.g. "https://host:10006").

Returns a SINGLE EnvironmentDescriptor, not a slice -- deliberately, and non-obviously so. Real Azure's public /metadata/endpoints does return a JSON array (the multi-cloud discovery list: public/US Gov/China/etc), and that public shape is what most docs and examples show. But terraform-provider-azurerm's metadata_host custom-environment path never hits that public endpoint or its array-shaped client: it goes through hashicorp/go-azure-sdk's environments.FromEndpoint -> sdk/internal/metadata/client.go's GetMetaData, which does `json.Unmarshal(respBody, &metadata)` into a single `*metaDataResponse` struct. An array response there fails with "json: cannot unmarshal array into Go value of type metadata.metaDataResponse" -- a real bug M7 shipped with, undetected because no `terraform apply` had ever reached this endpoint until M8's CI-discovery-glob fix let the Terraform suite actually run (AZURE.md section 10.8 records this). Do not "fix" this back to an array without re-reading that section first.

type EnvironmentSuffixes ¶

type EnvironmentSuffixes struct {
	Storage            string `json:"storage"`
	KeyVaultDNS        string `json:"keyVaultDns"`
	SQLServerHostname  string `json:"sqlServerHostname"`
	ACRLoginServer     string `json:"acrLoginServer"`
	AzureDatalakeStore string `json:"azureDataLakeStoreFileSystem,omitempty"`
}

EnvironmentSuffixes is EnvironmentDescriptor's "suffixes" field.

type EventGrid ¶

type EventGrid interface {
	// mapping is the topic's ARM inputSchemaMapping object, nil when absent.
	PutTopic(name, resourceID, inputSchema string, mapping map[string]any) (EventGridTopic, error)
	TopicInfo(name string) (EventGridTopic, bool)
	DeleteTopic(name string) error
	TopicKeys(name string) (key1, key2 string, err error)
	RegenerateTopicKey(name, keyName string) (key1, key2 string, err error)

	PutSubscription(ctx context.Context, topic, name string, props map[string]any) (map[string]any, error)
	GetSubscription(topic, name string) (map[string]any, bool)
	DeleteSubscription(topic, name string) error
	SubscriptionFullURL(topic, name string) (string, error)

	PutNamespace(name string) error
	DeleteNamespace(name string) error
	NamespaceKeys(name string) (key1, key2 string, err error)
	RegenerateNamespaceKey(name, keyName string) (key1, key2 string, err error)
	PutNamespaceTopic(ns, name string) (time.Time, error)
	NamespaceTopicCreated(ns, name string) (time.Time, bool)
	DeleteNamespaceTopic(ns, name string) error

	PutPullSubscription(ns, topic, name string, props map[string]any) (map[string]any, error)
	GetPullSubscription(ns, topic, name string) (map[string]any, bool)
	DeletePullSubscription(ns, topic, name string) error

	PutDomain(name, resourceID, inputSchema string, autoCreate, autoDelete *bool) (EventGridDomain, error)
	DomainInfo(name string) (EventGridDomain, bool)
	DeleteDomain(name string) error
	DomainKeys(name string) (key1, key2 string, err error)
	RegenerateDomainKey(name, keyName string) (key1, key2 string, err error)
	PutDomainTopic(domain, name string) (time.Time, error)
	DomainTopic(domain, name string) (EventGridDomainTopic, bool)
	DomainTopics(domain string) ([]EventGridDomainTopic, error)
	DeleteDomainTopic(domain, name string) error

	// The scoped calls address a custom topic (domain empty), a domain (topic empty) or a domain topic.
	PutScopedSubscription(ctx context.Context, domain, topic, name string, props map[string]any) (map[string]any, error)
	GetScopedSubscription(domain, topic, name string) (map[string]any, bool)
	DeleteScopedSubscription(domain, topic, name string) error
	ScopedSubscriptionFullURL(domain, topic, name string) (string, error)
	DeliveryAttributes(domain, topic, name string) ([]map[string]any, error)
	// PatchScopedSubscription merges an EventSubscriptionUpdateParameters body into an existing subscription.
	PatchScopedSubscription(
		ctx context.Context,
		domain, topic, name string,
		patch map[string]any,
	) (map[string]any, error)

	// The resource calls address event subscriptions of an ARM scope: a subscription, resource group or resource.
	PutResourceSubscription(ctx context.Context, scopeID, name string, props map[string]any) (map[string]any, error)
	GetResourceSubscription(scopeID, name string) (map[string]any, bool)
	DeleteResourceSubscription(scopeID, name string) error
	ResourceSubscriptionFullURL(scopeID, name string) (string, error)
	ResourceDeliveryAttributes(scopeID, name string) ([]map[string]any, error)
	PatchResourceSubscription(ctx context.Context, scopeID, name string, patch map[string]any) (map[string]any, error)
}

EventGrid is the seam the Microsoft.EventGrid resource provider uses to keep the Event Grid data plane in step with ARM. Subscription and namespace-topic subscription properties cross as ARM property maps, so this package never imports services/azureeventgrid.

type EventGridDomain ¶

type EventGridDomain struct {
	CreatedAt   time.Time
	InputSchema string
	AutoCreate  bool
	AutoDelete  bool
}

EventGridDomain is the data plane's view of a domain.

type EventGridDomainTopic ¶

type EventGridDomainTopic struct {
	CreatedAt time.Time
	Name      string
}

EventGridDomainTopic is the data plane's view of a domain topic.

type EventGridEndpointConfig ¶

type EventGridEndpointConfig struct {
	Override string
	Port     int
}

EventGridEndpointConfig configures the endpoints the provider advertises.

type EventGridProvider ¶

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

EventGridProvider implements ResourceProvider for Microsoft.EventGrid. ARM keeps only ARM-side metadata; topics, keys, subscriptions and queued events live in the data plane.

func NewEventGridProvider ¶

func NewEventGridProvider(cfg EventGridEndpointConfig, dataPlane EventGrid) *EventGridProvider

NewEventGridProvider creates an EventGridProvider; dataPlane may be nil.

func (*EventGridProvider) Delete ¶

Delete implements ResourceProvider.

func (*EventGridProvider) DeleteResourcesInGroup ¶

func (p *EventGridProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*EventGridProvider) DeleteScopeSubscription ¶

func (p *EventGridProvider) DeleteScopeSubscription(scope EventSubscriptionScope, name string) error

DeleteScopeSubscription removes an event subscription of an ARM scope.

func (*EventGridProvider) DeliveryAttributes ¶

func (p *EventGridProvider) DeliveryAttributes(_ context.Context, id ResourceID) (map[string]any, error)

DeliveryAttributes returns a subscription's delivery attribute mappings with secret values (POST .../getDeliveryAttributes).

func (*EventGridProvider) FullURL ¶

func (p *EventGridProvider) FullURL(_ context.Context, id ResourceID) (map[string]any, error)

FullURL returns a WebHook subscription's complete endpoint URL (POST .../getFullUrl).

func (*EventGridProvider) Get ¶

Get implements ResourceProvider.

func (*EventGridProvider) List ¶

func (p *EventGridProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider; only topics and namespaces are listable.

func (*EventGridProvider) ListDomainTopics ¶

func (p *EventGridProvider) ListDomainTopics(_ context.Context, id ResourceID) ([]map[string]any, error)

ListDomainTopics lists the topics of the domain identified by id.

func (*EventGridProvider) ListEventSubscriptions ¶

func (p *EventGridProvider) ListEventSubscriptions(q EventSubscriptionQuery) ([]map[string]any, string, error)

ListEventSubscriptions lists event subscriptions per q and returns the page and the next token.

func (*EventGridProvider) ListKeys ¶

func (p *EventGridProvider) ListKeys(_ context.Context, id ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider for topics and namespaces.

func (*EventGridProvider) Namespace ¶

func (p *EventGridProvider) Namespace() string

Namespace implements ResourceProvider.

func (*EventGridProvider) PatchScopeSubscription ¶

func (p *EventGridProvider) PatchScopeSubscription(
	ctx context.Context, scope EventSubscriptionScope, name string, body map[string]any,
) (map[string]any, error)

PatchScopeSubscription applies an EventSubscriptionUpdateParameters body to an existing event subscription of an ARM scope.

func (*EventGridProvider) PatchSubscription ¶

func (p *EventGridProvider) PatchSubscription(
	ctx context.Context, id ResourceID, body map[string]any,
) (map[string]any, error)

PatchSubscription applies an EventSubscriptionUpdateParameters body to an existing topic, domain or domain topic event subscription and returns the updated resource.

func (*EventGridProvider) Put ¶

func (p *EventGridProvider) Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*EventGridProvider) PutScopeSubscription ¶

func (p *EventGridProvider) PutScopeSubscription(
	ctx context.Context, scope EventSubscriptionScope, name string, body map[string]any,
) (map[string]any, error)

PutScopeSubscription creates or updates an event subscription on an ARM scope.

func (*EventGridProvider) RegenerateKey ¶

func (p *EventGridProvider) RegenerateKey(_ context.Context, id ResourceID, keyName string) (map[string]any, error)

RegenerateKey replaces key1 or key2 and returns both keys.

func (*EventGridProvider) Reset ¶

func (p *EventGridProvider) Reset()

Reset implements ResourceProvider.

func (*EventGridProvider) ResourceTypes ¶

func (p *EventGridProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*EventGridProvider) ScopeDeliveryAttributes ¶

func (p *EventGridProvider) ScopeDeliveryAttributes(
	scope EventSubscriptionScope, name string,
) (map[string]any, error)

ScopeDeliveryAttributes returns a subscription's delivery attribute mappings with secret values.

func (*EventGridProvider) ScopeSubscription ¶

func (p *EventGridProvider) ScopeSubscription(scope EventSubscriptionScope, name string) (map[string]any, error)

ScopeSubscription returns an event subscription of an ARM scope.

func (*EventGridProvider) ScopeSubscriptionFullURL ¶

func (p *EventGridProvider) ScopeSubscriptionFullURL(
	scope EventSubscriptionScope, name string,
) (map[string]any, error)

ScopeSubscriptionFullURL returns a WebHook subscription's complete endpoint URL.

type EventGridTopic ¶

type EventGridTopic struct {
	CreatedAt   time.Time
	InputSchema string
}

EventGridTopic is the data plane's view of a custom topic.

type EventHubEndpointConfig ¶

type EventHubEndpointConfig struct {
	Override string
	Port     int
	AMQPPort int
}

EventHubEndpointConfig configures the endpoints the provider advertises.

type EventHubInfo ¶

type EventHubInfo struct {
	CreatedAt    time.Time
	PartitionIDs []string
	Retention    time.Duration
}

EventHubInfo is the data plane's view of an event hub.

type EventHubProvider ¶

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

EventHubProvider implements ResourceProvider for Microsoft.EventHub. ARM keeps only ARM-side metadata; hubs, consumer groups, rules and their keys live in the data plane.

func NewEventHubProvider ¶

func NewEventHubProvider(cfg EventHubEndpointConfig, dataPlane EventHubs) *EventHubProvider

NewEventHubProvider creates an EventHubProvider; dataPlane may be nil.

func (*EventHubProvider) BreakPairing ¶

func (p *EventHubProvider) BreakPairing(id ResourceID) error

BreakPairing stops replication: the primary's config becomes PrimaryNotReplicating and the secondary's is removed.

func (*EventHubProvider) CheckDRNameAvailability ¶

func (p *EventHubProvider) CheckDRNameAvailability(id ResourceID, body map[string]any) (map[string]any, error)

CheckDRNameAvailability reports whether name can be used as an alias.

func (*EventHubProvider) Delete ¶

func (p *EventHubProvider) Delete(_ context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*EventHubProvider) DeleteResourcesInGroup ¶

func (p *EventHubProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*EventHubProvider) FailOver ¶

func (p *EventHubProvider) FailOver(id ResourceID) error

FailOver makes the secondary the active namespace: its config becomes PrimaryNotReplicating and the pairing, with the former primary's config, is removed.

func (*EventHubProvider) Get ¶

func (p *EventHubProvider) Get(_ context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*EventHubProvider) List ¶

func (p *EventHubProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider.

func (*EventHubProvider) ListKeys ¶

func (p *EventHubProvider) ListKeys(_ context.Context, id ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider for .../authorizationRules/{rule}/listKeys.

func (*EventHubProvider) Namespace ¶

func (p *EventHubProvider) Namespace() string

Namespace implements ResourceProvider.

func (*EventHubProvider) Put ¶

func (p *EventHubProvider) Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*EventHubProvider) RegenerateKeys ¶

func (p *EventHubProvider) RegenerateKeys(id ResourceID, body map[string]any) (map[string]any, error)

RegenerateKeys replaces a rule's primary or secondary key (with body.key when given) and returns the new keys.

func (*EventHubProvider) Reset ¶

func (p *EventHubProvider) Reset()

Reset implements ResourceProvider.

func (*EventHubProvider) ResourceTypes ¶

func (p *EventHubProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

type EventHubRule ¶

type EventHubRule struct {
	PrimaryKey   string
	SecondaryKey string
	Rights       []string
}

EventHubRule is the data plane's view of an authorization rule.

type EventHubRuleEntry ¶

type EventHubRuleEntry struct {
	Hub  string
	Name string
	EventHubRule
}

EventHubRuleEntry is a rule with its name and the hub it is scoped to ("" for the namespace).

type EventHubs ¶

type EventHubs interface {
	EnsureNamespace(name string) error
	DeleteNamespace(name string) error
	CreateHub(ns, name string, partitionCount int, retention time.Duration) (EventHubInfo, error)
	HubInfo(ns, name string) (EventHubInfo, bool)
	DeleteHub(ns, name string) error
	CreateConsumerGroup(ns, hub, name string) error
	DeleteConsumerGroup(ns, hub, name string) error
	PutRule(ns, hub, name string, rights []string) (EventHubRule, error)
	GetRule(ns, hub, name string) (EventHubRule, bool)
	DeleteRule(ns, hub, name string) error
	// RegenerateRuleKey replaces a rule's PrimaryKey or SecondaryKey with key, or a random key when key is empty.
	RegenerateRuleKey(ns, hub, name, keyType, key string) (EventHubRule, error)
	// ListRules returns the authorization rules of a namespace and its hubs.
	ListRules(ns string) ([]EventHubRuleEntry, error)
}

EventHubs is the seam the Microsoft.EventHub resource provider uses to keep the Event Hubs data plane in step with ARM. Primitive types only, so this package never imports services/azureeventhubs. hub is empty for namespace-scoped rules.

type EventSubscriptionQuery ¶

type EventSubscriptionQuery struct {
	// OwnerID, when set, restricts the list to subscriptions owned by that resource.
	OwnerID        string
	SubscriptionID string
	ResourceGroup  string
	Location       string
	TopicType      string
	Filter         string
	SkipToken      string
	// Regional selects subscriptions of Event Grid topics and domains (by location);
	// otherwise subscriptions of subscriptions, resource groups and other resources.
	Regional bool
	Top      int
}

EventSubscriptionQuery selects the event subscriptions a list operation returns.

type EventSubscriptionScope ¶

type EventSubscriptionScope struct {
	ID             string
	SubscriptionID string
	ResourceGroup  string
}

EventSubscriptionScope identifies the owner of an event subscription that is not an Event Grid resource: a subscription, a resource group or a resource.

type FileCORSRule ¶

type FileCORSRule struct {
	AllowedOrigins  []string
	AllowedMethods  []string
	AllowedHeaders  []string
	ExposedHeaders  []string
	MaxAgeInSeconds int32
}

FileCORSRule is one properties.cors.corsRules entry.

type FileSMBSettings ¶

type FileSMBSettings struct {
	Versions                 string
	AuthenticationMethods    string
	KerberosTicketEncryption string
	ChannelEncryption        string
	MultichannelEnabled      bool
}

FileSMBSettings is properties.protocolSettings.smb; list values are semicolon separated strings.

type FileServices ¶

type FileServices interface {
	SetShareRetention(account string, enabled bool, days int32)
	ShareRetention(account string) (bool, int32)
	SetCORS(account string, rules []FileCORSRule) error
	CORS(account string) []FileCORSRule
	SetSMB(account string, s FileSMBSettings)
	SMB(account string) FileSMBSettings
}

FileServices is the seam through which the file service's share soft-delete policy reaches the Azure Files data plane.

type FileShareACL ¶

type FileShareACL struct {
	ID         string
	Start      string
	Expiry     string
	Permission string
}

FileShareACL is one stored access policy of a share.

type FileShareError ¶

type FileShareError struct {
	Code    string
	Message string
	Status  int
}

FileShareError is a data-plane refusal carried to the client with its own status and code.

func (*FileShareError) Error ¶

func (e *FileShareError) Error() string

type FileShareInput ¶

type FileShareInput struct {
	Metadata       map[string]string
	Quota          *int64
	Iops           *int64
	Bandwidth      *int64
	BurstIops      *int64
	BurstBandwidth *int64
	IncludedBurst  *int64
	BurstCredits   *int64
	PaidBursting   *bool
	Tier           string
	Protocols      string
	RootSquash     string
	ACL            []FileShareACL
	HasMetadata    bool
	HasACL         bool
}

FileShareInput is the writable part of a Microsoft.Storage file share.

type FileShareView ¶

type FileShareView struct {
	Created        time.Time
	LastModified   time.Time
	TierChanged    time.Time
	DeletedAt      time.Time
	Metadata       map[string]string
	Iops           *int64
	Bandwidth      *int64
	BurstIops      *int64
	BurstBandwidth *int64
	IncludedBurst  *int64
	BurstCredits   *int64
	PaidBursting   *bool
	SnapshotVDir   *bool
	Name           string
	ETag           string
	Tier           string
	Protocols      string
	RootSquash     string
	Snapshot       string
	LeaseStatus    string
	LeaseState     string
	LeaseDuration  string
	Version        string
	ACL            []FileShareACL
	Usage          int64
	RemainingDays  int32
	Quota          int32
	Deleted        bool
}

FileShareView is a share, share snapshot or soft-deleted share as the data plane holds it.

type FileShares ¶

type FileShares interface {
	PutFileShare(account, name string, in FileShareInput, create bool) (FileShareView, bool, error)
	GetFileShare(account, name, snapshot string) (FileShareView, error)
	ListFileShares(account string, snapshots, deleted bool) []FileShareView
	DeleteFileShare(account, name, snapshot, include string) (bool, error)
	RestoreFileShare(account, target, deletedName, deletedVersion string) error
}

FileShares is the seam the Microsoft.Storage fileServices/shares resource uses to reach the Azure Files data plane. Implementations return *FileShareError for refusals.

type FlexDBProvider ¶

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

FlexDBProvider implements ResourceProvider for Microsoft.DBforPostgreSQL and Microsoft.DBforMySQL flexible servers (one instance per namespace). ARM keeps the server metadata and child resources; with an engine wired, real database servers run behind the FlexEngine seam.

func NewMySQLFlexProvider ¶

func NewMySQLFlexProvider() *FlexDBProvider

NewMySQLFlexProvider creates the Microsoft.DBforMySQL provider.

func NewPostgresFlexProvider ¶

func NewPostgresFlexProvider() *FlexDBProvider

NewPostgresFlexProvider creates the Microsoft.DBforPostgreSQL provider.

func (*FlexDBProvider) Action ¶

func (p *FlexDBProvider) Action(id ResourceID, action string) (string, error)

Action runs start, stop or restart and returns the operation it started.

func (*FlexDBProvider) ActionWithBody ¶

func (p *FlexDBProvider) ActionWithBody(id ResourceID, action string, body map[string]any) (string, error)

ActionWithBody is Action with the request body of the restart action.

func (*FlexDBProvider) BatchUpdateConfigs ¶

func (p *FlexDBProvider) BatchUpdateConfigs(id ResourceID, body map[string]any) ([]map[string]any, error)

BatchUpdateConfigs applies MySQL updateConfigurations: every entry is validated first and the batch is applied as a whole or not at all; resetAllToDefault True resets every writable parameter before the entries apply.

func (*FlexDBProvider) Capabilities ¶

func (p *FlexDBProvider) Capabilities() []map[string]any

Capabilities returns the location capability list in the flavor's v1 shape.

func (*FlexDBProvider) CapabilitySet ¶

func (p *FlexDBProvider) CapabilitySet(sub string) map[string]any

CapabilitySet returns the MySQL v2 capability set named aksDefaultName.

func (*FlexDBProvider) CheckName ¶

func (p *FlexDBProvider) CheckName(_ context.Context, name, typ string) map[string]any

CheckName answers checkNameAvailability for a server name. Names are unique across the subscription.

func (*FlexDBProvider) Close ¶

func (p *FlexDBProvider) Close()

Close stops background work and the engine's servers.

func (*FlexDBProvider) Delete ¶

func (p *FlexDBProvider) Delete(_ context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*FlexDBProvider) DeleteResourcesInGroup ¶

func (p *FlexDBProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*FlexDBProvider) DetachVNet ¶

func (p *FlexDBProvider) DetachVNet(id ResourceID, body map[string]any) (string, error)

DetachVNet moves a MySQL server from virtual network integration to public access (armmysqlflexibleservers ServersClient.BeginDetachVNet).

func (*FlexDBProvider) Get ¶

func (p *FlexDBProvider) Get(_ context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*FlexDBProvider) List ¶

func (p *FlexDBProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider; only servers are listable here, children use ListChildren.

func (*FlexDBProvider) ListChildren ¶

func (p *FlexDBProvider) ListChildren(id ResourceID, collection string) ([]map[string]any, error)

ListChildren returns the firewall rules, databases, configurations or replicas of a server.

func (*FlexDBProvider) ListKeys ¶

func (p *FlexDBProvider) ListKeys(context.Context, ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider; flexible servers have no keys.

func (*FlexDBProvider) Namespace ¶

func (p *FlexDBProvider) Namespace() string

Namespace implements ResourceProvider.

func (*FlexDBProvider) OperationStatus ¶

func (p *FlexDBProvider) OperationStatus(opID string) (flexOp, bool, bool)

OperationStatus reports whether opID is known, finished, and its failure message.

func (*FlexDBProvider) Put ¶

func (p *FlexDBProvider) Put(_ context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*FlexDBProvider) Remove ¶

func (p *FlexDBProvider) Remove(id ResourceID) (string, error)

Remove deletes a resource and returns the async operation it started.

func (*FlexDBProvider) Reset ¶

func (p *FlexDBProvider) Reset()

Reset implements ResourceProvider.

func (*FlexDBProvider) ResourceTypes ¶

func (p *FlexDBProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*FlexDBProvider) RunBackupCycle ¶

func (p *FlexDBProvider) RunBackupCycle(ctx context.Context)

RunBackupCycle removes backups past their retention and takes the daily automatic backup of every running server that has none from the last 24 hours, all on the provider's clock.

func (*FlexDBProvider) SetClock ¶

func (p *FlexDBProvider) SetClock(now func() time.Time)

SetClock replaces the provider's clock.

func (*FlexDBProvider) SetDumpDir ¶

func (p *FlexDBProvider) SetDumpDir(dir string, maxBytes int64)

SetDumpDir sets where database dumps (backups and replica seeds) are kept and how large one may grow. An empty dir uses a temporary directory that is removed on Close.

func (*FlexDBProvider) SetEngine ¶

func (p *FlexDBProvider) SetEngine(e FlexEngine)

SetEngine wires the database engine; nil keeps servers ARM-only.

func (*FlexDBProvider) SetNetwork ¶

func (p *FlexDBProvider) SetNetwork(n *NetworkProvider)

SetNetwork lets the provider validate delegated subnets against Microsoft.Network.

func (*FlexDBProvider) SubnetUsage ¶

func (p *FlexDBProvider) SubnetUsage(sub, location, vnetID string) (map[string]any, error)

SubnetUsage answers checkVirtualNetworkSubnetUsage: for each subnet of the virtual network delegated to the engine, the number of servers whose delegatedSubnetResourceId is that subnet.

func (*FlexDBProvider) Write ¶

func (p *FlexDBProvider) Write(id ResourceID, method string, body map[string]any) (flexResult, error)

Write applies a PUT or PATCH and returns the body and the async operation it started.

type FlexEndpoint ¶

type FlexEndpoint struct {
	Host string
	Port int
}

FlexEndpoint is where a server's engine listens.

type FlexEngine ¶

type FlexEngine interface {
	Ensure(ctx context.Context, id string, spec FlexSpec) (FlexEndpoint, error)
	Endpoint(id string) (FlexEndpoint, bool)
	SetPassword(ctx context.Context, id, login, password string) error
	Stop(ctx context.Context, id string) error
	Start(ctx context.Context, id string) error
	Restart(ctx context.Context, id string) error
	CreateDatabase(ctx context.Context, id, name, charset, collation string) error
	DropDatabase(ctx context.Context, id, name string) error
	Delete(ctx context.Context, id string) error
	// ApplyParameters persists the parameters in the running engine and reloads it; static ones wait for a restart.
	ApplyParameters(ctx context.Context, id string, params []FlexParam) error
	// Dump streams a logical dump of the named user databases (and the engine's default database where it has
	// one) to w.
	Dump(ctx context.Context, id string, dbs []string, w io.Writer) error
	// Restore loads a Dump stream into the server and stops at the first error.
	Restore(ctx context.Context, id string, r io.Reader) error
	// CopyAdmin gives the server dst the administrator login and password of the server src, which stay inside
	// the engine.
	CopyAdmin(ctx context.Context, src, dst string) error
	// SetReadOnly makes the server refuse writes (replicas) or accept them again (promotion).
	SetReadOnly(ctx context.Context, id string, on bool) error
}

FlexEngine is the seam the flexible server providers use to run real database servers. id is the lower-cased ARM resource ID of the server. Primitive types only.

func NewDockerFlexEngine ¶

func NewDockerFlexEngine(kind string, cfg DockerFlexConfig) FlexEngine

NewDockerFlexEngine returns a FlexEngine for kind flexKindPostgres or flexKindMySQL.

type FlexParam ¶

type FlexParam struct {
	Name   string
	Value  string
	Reset  bool
	Static bool
}

FlexParam is one server parameter change for the running engine. Reset restores the engine default; Static parameters only take effect after the next restart.

type FlexSpec ¶

type FlexSpec struct {
	Version       string
	AdminLogin    string
	AdminPassword string
}

FlexSpec is what the database engine needs to bring up one flexible server. AdminPassword is empty when the request did not carry one.

type FunctionAppConfig ¶

type FunctionAppConfig struct {
	Kind            string
	LinuxFx         string
	AppCommandLine  string
	HealthCheckPath string
	// Hosting is the plan family: Consumption, Flex, Premium or Dedicated; empty when unknown.
	Hosting string
	// ACRIdentityID is the client ID of the user-assigned identity that pulls the container image (empty: the
	// system-assigned identity); it applies when ACRManagedID is set.
	ACRIdentityID string
	Flex          bool
	AlwaysOn      bool
	AlwaysReady   bool
	ACRManagedID  bool
}

FunctionAppConfig is what ARM tells the data plane about a function app's stack.

type FunctionAppFunction ¶

type FunctionAppFunction struct {
	Config     map[string]any
	Name       string
	Language   string
	InvokeURL  string
	IsDisabled bool
}

FunctionAppFunction is one function of an app.

type FunctionAppInfo ¶

type FunctionAppInfo struct {
	Created    time.Time
	LastDeploy time.Time
	HostName   string
	SCMHost    string
	Image      string
	Worker     string
	Failure    string
	Stopped    bool
	Deployed   bool
}

FunctionAppInfo is the data plane's view of a function app.

type FunctionApps ¶

type FunctionApps interface {
	PutApp(name string, cfg FunctionAppConfig) (FunctionAppInfo, error)
	DeleteApp(name string) error
	AppInfo(name string) (FunctionAppInfo, bool)
	Settings(name string) (map[string]string, error)
	SetSettings(name string, settings map[string]string) error
	// SetConnectionStrings sets the connection strings as the prefixed environment variables the host receives.
	SetConnectionStrings(name string, env map[string]string) error
	SetStopped(name string, stopped bool) error
	Restart(name string) error
	Functions(ctx context.Context, name string) ([]FunctionAppFunction, error)
	HostKeys(name string) (FunctionHostKeys, error)
	SetHostKey(name, keyType, keyName, value string) (string, error)
	DeleteHostKey(name, keyType, keyName string) error
	FunctionKeys(name, fn string) (map[string]string, error)
	SetFunctionKey(name, fn, keyName, value string) (string, error)
	DeleteFunctionKey(name, fn, keyName string) error
	PublishingCredentials(name string) (user, password, scmURI string, err error)
	SwapContent(first, second string) error
	WarmUp(ctx context.Context, name string) error
	DeleteFunction(ctx context.Context, name, fn string) error
	AdminToken(name string) (string, error)
	SyncTriggers(ctx context.Context, name string) error
}

FunctionApps is the seam the Microsoft.Web resource provider uses to keep function apps and Linux web apps in step with the Azure Functions data plane. Primitive types only, so this package never imports the data-plane service. Slots are addressed as "<app>/<slot>". Implementations return ErrWebSiteNotFound, ErrWebFunctionNotFound, ErrWebKeyNotFound or ErrWebInvalidKeyType.

type FunctionHostKeys ¶

type FunctionHostKeys struct {
	FunctionKeys map[string]string
	SystemKeys   map[string]string
	MasterKey    string
}

FunctionHostKeys are an app's host-level keys.

type GraphPortProvider ¶

type GraphPortProvider interface {
	GetAzureGraphPort() int
}

GraphPortProvider is a private interface AppContext.Config may implement to expose the Graph listener's port.

type Handler ¶

type Handler struct {
	Backend  *InMemoryBackend
	Registry *Registry
	Issuer   *aadauth.Issuer

	Settings Settings
	Port     int
	// contains filtered or unexported fields
}

Handler is the Echo HTTP handler for the ARM emulation's dedicated listener.

func NewHandler ¶

func NewHandler(backend *InMemoryBackend, registry *Registry, issuer *aadauth.Issuer, settings Settings) *Handler

NewHandler creates a new ARM Handler.

func (*Handler) ExtractOperation ¶

func (h *Handler) ExtractOperation(c *echo.Context) string

ExtractOperation extracts the ARM operation name from the request, for metrics labeling.

func (*Handler) ExtractResource ¶

func (h *Handler) ExtractResource(c *echo.Context) string

ExtractResource extracts a resource identifier from the request path, for metrics labeling.

func (*Handler) GetSupportedOperations ¶

func (h *Handler) GetSupportedOperations() []string

GetSupportedOperations returns the list of supported ARM operations.

func (*Handler) Handler ¶

func (h *Handler) Handler() echo.HandlerFunc

Handler returns the Echo handler function for ARM operations.

func (*Handler) MatchPriority ¶

func (h *Handler) MatchPriority() int

MatchPriority returns the routing priority for the AzureARM handler. Irrelevant in practice since RouteMatcher never matches; 0 is the safe default.

func (*Handler) Name ¶

func (h *Handler) Name() string

Name returns the service name.

func (*Handler) Reset ¶

func (h *Handler) Reset()

Reset clears all in-memory ARM state.

func (*Handler) Restore ¶

func (h *Handler) Restore(ctx context.Context, data []byte) error

Restore implements persistence.Persistable.

func (*Handler) RouteMatcher ¶

func (h *Handler) RouteMatcher() service.Matcher

RouteMatcher exists only to satisfy service.Registerable's interface contract: AzureARM deliberately never matches on the shared AWS single-port Router, exactly like services/azureblob/azurequeue/azuretable/ cosmosdb -- it runs on its own dedicated HTTPS listener started by StartWorker. Only RouteMatcher itself is inert.

func (*Handler) SetClientAuthenticator ¶

func (h *Handler) SetClientAuthenticator(a ClientAuthenticator)

SetClientAuthenticator makes the token endpoint verify secrets of applications the directory knows. Call before the listener starts.

func (*Handler) SetPrincipalDirectory ¶

func (h *Handler) SetPrincipalDirectory(dir PrincipalDirectory)

SetPrincipalDirectory lets role assignments resolve principals against dir; with Settings.ValidatePrincipals set, unknown principals are rejected with PrincipalNotFound.

func (*Handler) SetResourceObserver ¶

func (h *Handler) SetResourceObserver(o ResourceObserver)

SetResourceObserver registers the observer; call it before the handler serves requests.

func (*Handler) Shutdown ¶

func (h *Handler) Shutdown(ctx context.Context)

Shutdown stops the dedicated ARM listener, mirroring services/azureblob.Handler.Shutdown's graceful-then-forced-close shape.

func (*Handler) Snapshot ¶

func (h *Handler) Snapshot(ctx context.Context) []byte

Snapshot implements persistence.Persistable: backend state plus the Microsoft.KeyVault provider's ARM-side vaults and deleted vaults.

func (*Handler) StartWorker ¶

func (h *Handler) StartWorker(ctx context.Context) error

StartWorker binds AzureARM's dedicated fixed port and serves HTTPS -- either with a stable caller-supplied certificate or a freshly generated self-signed one (see loadOrGenerateCert) -- synchronously, failing fast if the port is unavailable rather than falling back into the shared PortAlloc pool -- exactly like services/azureblob/azurequeue/azuretable/cosmosdb's StartWorker (see AZURE.md section 10.7). Unlike those, ARM serves HTTPS unconditionally: azurerm's metadata_host handling hardcodes "https://" (AZURE.md section 10.8), so a plain-HTTP listener here would make provider initialization fail outright, not merely warn.

type InMemoryBackend ¶

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

InMemoryBackend owns the ARM resource graph: one subscription's resource groups, its generic resource-provider-registration state, and the flat map of every resource not owned by a dedicated ResourceProvider's own internal state (e.g. rp_storage.go keeps its own storage-account map -- see registry.go for how the two interact). This is ARM-side metadata ONLY, never a second copy of any data-plane service's state (AZURE.md section 10.9).

func NewInMemoryBackend ¶

func NewInMemoryBackend() *InMemoryBackend

NewInMemoryBackend creates an empty InMemoryBackend.

func (*InMemoryBackend) DeleteResourceGroup ¶

func (b *InMemoryBackend) DeleteResourceGroup(name string) error

DeleteResourceGroup deletes the resource group named name, along with every generic resource whose ResourceGroup matches (case-insensitively). Resources owned by a dedicated ResourceProvider's own internal state (e.g. storage accounts) are NOT cascaded here -- see registry.go's DeleteResourcesInGroup, which handler.go calls across every registered provider before calling this.

func (*InMemoryBackend) GetResourceGroup ¶

func (b *InMemoryBackend) GetResourceGroup(name string) (ResourceGroup, error)

GetResourceGroup returns the resource group named name.

func (*InMemoryBackend) IsProviderRegistered ¶

func (b *InMemoryBackend) IsProviderRegistered(subscriptionID, namespace string) bool

IsProviderRegistered reports whether namespace has been registered for subscriptionID.

func (*InMemoryBackend) ListResourceGroups ¶

func (b *InMemoryBackend) ListResourceGroups() []ResourceGroup

ListResourceGroups returns every resource group, sorted by name.

func (*InMemoryBackend) ProviderRegistrationState ¶

func (b *InMemoryBackend) ProviderRegistrationState(subscriptionID, namespace string) string

ProviderRegistrationState returns "Registered" or "NotRegistered" for namespace under subscriptionID, the value ARM's /providers/{ns} response carries in its "registrationState" field.

func (*InMemoryBackend) PutResourceGroup ¶

func (b *InMemoryBackend) PutResourceGroup(name, location string, tags map[string]string) (ResourceGroup, bool)

PutResourceGroup creates or updates the resource group named name. Always synchronous (AZURE.md section 10.3): the caller determines 200 vs 201 from the returned created bool.

func (*InMemoryBackend) RegisterProvider ¶

func (b *InMemoryBackend) RegisterProvider(subscriptionID, namespace string)

RegisterProvider marks namespace as registered for subscriptionID.

func (*InMemoryBackend) Reset ¶

func (b *InMemoryBackend) Reset()

Reset clears all in-memory ARM state. Used by the POST /_gopherstack/reset endpoint. Never touches any data-plane service's own state (AZURE.md section 10.9).

func (*InMemoryBackend) ResourceGroupExists ¶

func (b *InMemoryBackend) ResourceGroupExists(name string) bool

ResourceGroupExists reports whether a resource group named name exists.

func (*InMemoryBackend) Restore ¶

func (b *InMemoryBackend) Restore(ctx context.Context, data []byte) error

Restore loads backend state from a JSON snapshot. It implements persistence.Persistable. Restore must be idempotent against the data plane (AZURE.md section 10.9): this method only ever restores ARM's own metadata, never re-creates or otherwise touches any data-plane service's state.

func (*InMemoryBackend) Snapshot ¶

func (b *InMemoryBackend) Snapshot(ctx context.Context) []byte

Snapshot serializes the backend state to JSON. It implements persistence.Persistable.

type KeyVaultEndpointConfig ¶

type KeyVaultEndpointConfig struct {
	Override string
	Port     int
}

KeyVaultEndpointConfig configures how the KeyVault resource provider advertises properties.vaultUri.

type KeyVaultPortProvider ¶

type KeyVaultPortProvider interface {
	GetAzureKeyVaultPort() int
}

KeyVaultPortProvider is a private interface AppContext.Config may implement to expose the Key Vault listener's configured port.

type KeyVaultProvider ¶

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

KeyVaultProvider implements ResourceProvider for Microsoft.KeyVault/vaults. Vault lifecycle is delegated to the data plane through the KeyVaults seam.

func NewKeyVaultProvider ¶

func NewKeyVaultProvider(cfg KeyVaultEndpointConfig, dataPlane KeyVaults) *KeyVaultProvider

NewKeyVaultProvider creates a KeyVaultProvider; dataPlane may be nil.

func (*KeyVaultProvider) CheckNameAvailability ¶

func (p *KeyVaultProvider) CheckNameAvailability(name string) map[string]any

CheckNameAvailability implements the checkNameAvailability action.

func (*KeyVaultProvider) Delete ¶

func (p *KeyVaultProvider) Delete(_ context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*KeyVaultProvider) DeleteResourcesInGroup ¶

func (p *KeyVaultProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*KeyVaultProvider) Get ¶

func (p *KeyVaultProvider) Get(_ context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*KeyVaultProvider) GetDeleted ¶

func (p *KeyVaultProvider) GetDeleted(sub, location, name string) (map[string]any, error)

GetDeleted returns the wire body of a soft-deleted vault.

func (*KeyVaultProvider) List ¶

func (p *KeyVaultProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider.

func (*KeyVaultProvider) ListKeys ¶

func (p *KeyVaultProvider) ListKeys(context.Context, ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider; vaults have no listKeys action.

func (*KeyVaultProvider) Namespace ¶

func (p *KeyVaultProvider) Namespace() string

Namespace implements ResourceProvider.

func (*KeyVaultProvider) PurgeDeleted ¶

func (p *KeyVaultProvider) PurgeDeleted(sub, location, name string) error

PurgeDeleted permanently removes a soft-deleted vault, unless purge protection is enabled.

func (*KeyVaultProvider) Put ¶

func (p *KeyVaultProvider) Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*KeyVaultProvider) Reset ¶

func (p *KeyVaultProvider) Reset()

Reset implements ResourceProvider.

func (*KeyVaultProvider) ResourceTypes ¶

func (p *KeyVaultProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

type KeyVaultSecrets ¶

type KeyVaultSecrets interface {
	SecretValue(vault, name, version string) (string, error)
}

KeyVaultSecrets reads secret values for container app secrets that reference Key Vault.

type KeyVaults ¶

type KeyVaults interface {
	CreateVault(name string, retentionDays int, purgeProtection bool)
	DeleteVault(name string)
	// SoftDeleteVault retires the vault, keeping its contents for RecoverVault.
	SoftDeleteVault(name string)
	// RecoverVault restores a soft-deleted vault with its contents.
	RecoverVault(name string)
	// PurgeVault permanently discards a soft-deleted vault's contents.
	PurgeVault(name string)
}

KeyVaults is the seam the Microsoft.KeyVault resource provider uses to register and remove vaults in the Key Vault data plane. Primitive types only, so this package never imports services/azurekeyvault.

type LogicProvider ¶

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

LogicProvider implements ResourceProvider for Microsoft.Logic Consumption workflows: ARM CRUD, run history and the workflow engine that executes definitions.

func NewLogicProvider ¶

func NewLogicProvider() *LogicProvider

NewLogicProvider creates a LogicProvider on the wall clock.

func (*LogicProvider) Close ¶

func (p *LogicProvider) Close()

Close cancels every run and recurrence timer.

func (*LogicProvider) Delete ¶

func (p *LogicProvider) Delete(_ context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*LogicProvider) DeleteResourcesInGroup ¶

func (p *LogicProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*LogicProvider) Get ¶

func (p *LogicProvider) Get(ctx context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*LogicProvider) List ¶

func (p *LogicProvider) List(ctx context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider.

func (*LogicProvider) ListKeys ¶

func (p *LogicProvider) ListKeys(_ context.Context, id ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider; Logic workflows have no listKeys action.

func (*LogicProvider) Namespace ¶

func (p *LogicProvider) Namespace() string

Namespace implements ResourceProvider.

func (*LogicProvider) Put ¶

func (p *LogicProvider) Put(_ context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*LogicProvider) Reset ¶

func (p *LogicProvider) Reset()

Reset implements ResourceProvider.

func (*LogicProvider) ResourceTypes ¶

func (p *LogicProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*LogicProvider) ServeDataPlane ¶

func (p *LogicProvider) ServeDataPlane(rw http.ResponseWriter, r *http.Request) bool

ServeDataPlane answers requests under /_logic/workflows/: trigger invocation and run content reads. It reports false for any other path.

func (*LogicProvider) SetAllowExternal ¶

func (p *LogicProvider) SetAllowExternal(allow bool)

SetAllowExternal lets the HTTP action reach hosts outside loopback.

func (*LogicProvider) SetClock ¶

func (p *LogicProvider) SetClock(c gcpscale.Clock)

SetClock replaces the clock that drives Wait, Until, retries and Recurrence triggers.

func (*LogicProvider) SetOutboundRootCAs ¶

func (p *LogicProvider) SetOutboundRootCAs(pool *x509.CertPool)

SetOutboundRootCAs sets the roots outbound HTTPS calls verify against (nil: the system roots). Call it before the provider is in use.

func (*LogicProvider) WaitRuns ¶

func (p *LogicProvider) WaitRuns()

WaitRuns blocks until every started run has finished; runs parked on a clock timer finish once the clock advances.

type ManagedIdentityProvider ¶

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

ManagedIdentityProvider implements ResourceProvider for Microsoft.ManagedIdentity user-assigned identities.

func NewManagedIdentityProvider ¶

func NewManagedIdentityProvider(tenantID string) *ManagedIdentityProvider

NewManagedIdentityProvider creates a provider whose identities belong to tenantID.

func (*ManagedIdentityProvider) Delete ¶

Delete implements ResourceProvider.

func (*ManagedIdentityProvider) DeleteResourcesInGroup ¶

func (p *ManagedIdentityProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*ManagedIdentityProvider) Get ¶

Get implements ResourceProvider.

func (*ManagedIdentityProvider) List ¶

List implements ResourceProvider.

func (*ManagedIdentityProvider) ListKeys ¶

ListKeys implements ResourceProvider.

func (*ManagedIdentityProvider) Namespace ¶

func (p *ManagedIdentityProvider) Namespace() string

Namespace implements ResourceProvider.

func (*ManagedIdentityProvider) PatchResource ¶

func (p *ManagedIdentityProvider) PatchResource(id ResourceID, body map[string]any) (map[string]any, error)

PatchResource implements the identity Update operation: tags and the mutable properties (isolationScope, assignmentRestrictions) that the request carries.

func (*ManagedIdentityProvider) PatchTags ¶

func (p *ManagedIdentityProvider) PatchTags(id ResourceID, tags map[string]string) (map[string]any, error)

PatchTags implements the identity Update operation.

func (*ManagedIdentityProvider) Put ¶

func (p *ManagedIdentityProvider) Put(_ context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*ManagedIdentityProvider) Reset ¶

func (p *ManagedIdentityProvider) Reset()

Reset implements ResourceProvider.

func (*ManagedIdentityProvider) ResourceTypes ¶

func (p *ManagedIdentityProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*ManagedIdentityProvider) SetDefaultSubscription ¶

func (p *ManagedIdentityProvider) SetDefaultSubscription(sub string)

SetDefaultSubscription names the subscription that identities restored from a snapshot without one belong to.

type MonitorError ¶

type MonitorError struct {
	Code    string
	Message string
	Status  int
}

MonitorError is a data-plane failure carried to the ARM error envelope unchanged.

func (*MonitorError) Error ¶

func (e *MonitorError) Error() string

type MonitorLogs ¶

type MonitorLogs interface {
	Put(req MonitorRequest, body map[string]any) (map[string]any, error)
	Get(req MonitorRequest) (map[string]any, error)
	Patch(req MonitorRequest, body map[string]any) (map[string]any, error)
	Delete(req MonitorRequest) error
	List(req MonitorRequest) ([]map[string]any, error)
	Action(req MonitorRequest, action string, body map[string]any) (map[string]any, error)
	DeleteInGroup(rg string)
	Reset()
}

MonitorLogs is the seam the Microsoft.OperationalInsights and Microsoft.Insights providers use to keep workspaces, tables, data collection endpoints and rules in the Azure Monitor Logs data plane. Errors wrap ErrResourceNotFound or are *MonitorError values.

type MonitorProvider ¶

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

MonitorProvider implements ResourceProvider for Microsoft.OperationalInsights (workspaces, tables) and Microsoft.Insights (data collection endpoints and rules). Every other type under those namespaces keeps the generic metadata-only store.

func NewMonitorProvider ¶

func NewMonitorProvider(namespace string, backend *InMemoryBackend, dataPlane MonitorLogs) *MonitorProvider

NewMonitorProvider creates the provider for one namespace; dataPlane may be nil.

func (*MonitorProvider) Action ¶

func (p *MonitorProvider) Action(
	ctx context.Context, id ResourceID, action string, body map[string]any,
) (map[string]any, error)

Action runs a POST action on a workspace.

func (*MonitorProvider) Delete ¶

func (p *MonitorProvider) Delete(ctx context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*MonitorProvider) DeleteResourcesInGroup ¶

func (p *MonitorProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*MonitorProvider) Get ¶

func (p *MonitorProvider) Get(ctx context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*MonitorProvider) List ¶

func (p *MonitorProvider) List(ctx context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider.

func (*MonitorProvider) ListKeys ¶

func (p *MonitorProvider) ListKeys(ctx context.Context, id ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider; only workspaces have keys.

func (*MonitorProvider) Namespace ¶

func (p *MonitorProvider) Namespace() string

Namespace implements ResourceProvider.

func (*MonitorProvider) Patch ¶

func (p *MonitorProvider) Patch(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Patch updates tags and mutable properties.

func (*MonitorProvider) Put ¶

func (p *MonitorProvider) Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*MonitorProvider) Reset ¶

func (p *MonitorProvider) Reset()

Reset implements ResourceProvider.

func (*MonitorProvider) ResourceTypes ¶

func (p *MonitorProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

type MonitorRequest ¶

type MonitorRequest struct {
	Host      string
	Sub       string
	RG        string
	Namespace string
	Types     []string
	Names     []string
}

MonitorRequest addresses a Microsoft.OperationalInsights or Microsoft.Insights resource.

type NetworkProvider ¶

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

NetworkProvider implements ResourceProvider for Microsoft.Network.

func NewNetworkProvider ¶

func NewNetworkProvider(backend *InMemoryBackend) *NetworkProvider

NewNetworkProvider creates a provider; types it does not model fall through to backend's generic store.

func (*NetworkProvider) AGWAction ¶

func (p *NetworkProvider) AGWAction(id ResourceID, action string) error

AGWAction runs start or stop against an application gateway.

func (*NetworkProvider) AutoApprovedPLS ¶

func (p *NetworkProvider) AutoApprovedPLS(sub, rg, loc string) []map[string]any

AutoApprovedPLS lists the services in loc that approve connections of the subscription without review.

func (*NetworkProvider) BackendHealth ¶

func (p *NetworkProvider) BackendHealth(ctx context.Context, id ResourceID) (map[string]any, error)

BackendHealth probes loopback backends over real HTTP; every other backend is reported Unknown because the emulator has no route to it.

func (*NetworkProvider) CheckIPAddressAvailability ¶

func (p *NetworkProvider) CheckIPAddressAvailability(id ResourceID, ip string) (map[string]any, error)

CheckIPAddressAvailability implements the virtual network action of the same name.

func (*NetworkProvider) CheckPLSVisibility ¶

func (p *NetworkProvider) CheckPLSVisibility(sub, rg, loc, alias string) map[string]any

CheckPLSVisibility answers the checkPrivateLinkServiceVisibility actions; rg is empty for the subscription form.

func (*NetworkProvider) Delete ¶

func (p *NetworkProvider) Delete(_ context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*NetworkProvider) DeleteResourcesInGroup ¶

func (p *NetworkProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider; references from other groups to the removed resources are dropped so no association dangles.

func (*NetworkProvider) Get ¶

func (p *NetworkProvider) Get(_ context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*NetworkProvider) List ¶

func (p *NetworkProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider.

func (*NetworkProvider) ListKeys ¶

func (p *NetworkProvider) ListKeys(context.Context, ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider.

func (*NetworkProvider) Namespace ¶

func (p *NetworkProvider) Namespace() string

Namespace implements ResourceProvider.

func (*NetworkProvider) PatchTags ¶

func (p *NetworkProvider) PatchTags(id ResourceID, tags map[string]string) (map[string]any, error)

PatchTags replaces the tags of a top-level resource, as the UpdateTags operations do.

func (*NetworkProvider) Put ¶

func (p *NetworkProvider) Put(_ context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*NetworkProvider) Reset ¶

func (p *NetworkProvider) Reset()

Reset implements ResourceProvider.

func (*NetworkProvider) ResourceTypes ¶

func (p *NetworkProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*NetworkProvider) SetLookup ¶

func (p *NetworkProvider) SetLookup(f func(context.Context, ResourceID) (map[string]any, error))

SetLookup gives the provider a way to resolve private-link targets in other namespaces.

type PasswordAuthenticator ¶

type PasswordAuthenticator interface {
	AuthenticateUser(username, password string) (objectID, userPrincipalName string, err error)
}

PasswordAuthenticator is implemented by a ClientAuthenticator that also verifies resource-owner password sign-ins (grant_type=password). The error is a *ClientAuthError for a rejected sign-in.

type PolicyHit ¶

type PolicyHit struct {
	AssignmentID string
	DefinitionID string
	Effect       string
}

PolicyHit names the assignment and definition behind a policy decision.

type PolicyOutcome ¶

type PolicyOutcome struct {
	Deny *PolicyHit
	Body map[string]any
}

PolicyOutcome is the result of evaluating the assignments in force for a write.

type PrincipalDirectory ¶

type PrincipalDirectory interface {
	PrincipalType(id string) (string, bool)
}

PrincipalDirectory resolves role assignment principals; PrincipalType returns User, Group or ServicePrincipal.

type Provider ¶

type Provider struct{}

Provider implements service.Provider for the ARM emulation.

Like services/azureblob/azurequeue/azuretable/cosmosdb/azureservicebus, AzureARM does not register a RouteMatcher into the shared AWS single-port Router -- see handler.go's RouteMatcher doc comment. It is registered in cli.go's getMostRecentServiceProviders like every other provider; only its RouteMatcher (which always returns false) is inert.

func (*Provider) Init ¶

Init initializes the ARM backend, registry (with the Storage RP registered), AAD token issuer, and handler. The configured port (Settings.Port, default DefaultPort) is only recorded here; the actual TCP bind happens synchronously in Handler.StartWorker, so a port-in-use failure is returned to the caller directly instead of being discovered later from a background goroutine.

func (*Provider) Name ¶

func (p *Provider) Name() string

Name returns the service provider name.

type RampUpRule ¶

type RampUpRule struct {
	Name    string
	Percent float64
}

RampUpRule routes a share of a site's production traffic to one of its slots (siteConfig.experiments.rampUpRules).

type Redis ¶

type Redis interface {
	Ensure(id string, spec RedisSpec) (RedisEndpoint, error)
	Endpoint(id string) (RedisEndpoint, bool)
	Delete(id string) error
	Keys(id string) (RedisKeys, error)
	RegenerateKey(id, keyType string) (RedisKeys, error)
	Reboot(id, rebootType string) error
	Import(id, format string, files []string) error
	Export(id, format, prefix, container string) error
}

Redis is the seam the Microsoft.Cache resource provider uses to run real Redis servers for its caches. id is the lower-cased ARM resource ID. Primitive types only, so this package never imports services/azureredis.

type RedisAccessAssignment ¶

type RedisAccessAssignment struct {
	ObjectID    string
	Alias       string
	Permissions string
}

RedisAccessAssignment grants a principal the permissions string of a data access policy.

type RedisEndpoint ¶

type RedisEndpoint struct {
	Host    string
	Port    int
	SSLPort int
}

RedisEndpoint is where a cache's servers listen; Port is 0 while the plaintext port is disabled.

type RedisIPRange ¶

type RedisIPRange struct {
	Start string
	End   string
}

RedisIPRange is one inclusive IPv4 client range of a cache's firewall.

type RedisKeys ¶

type RedisKeys struct {
	Primary   string
	Secondary string
}

RedisKeys are a cache's access keys.

type RedisProvider ¶

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

RedisProvider implements ResourceProvider for Microsoft.Cache/redis. ARM keeps the resource metadata, firewall rules, patch schedule and linked servers; the Redis servers, access keys and data live behind the Redis seam.

func NewRedisProvider ¶

func NewRedisProvider(dataPlane Redis) *RedisProvider

NewRedisProvider creates a RedisProvider; dataPlane may be nil.

func (*RedisProvider) CreateOperation ¶

func (p *RedisProvider) CreateOperation(readyAt time.Time) string

CreateOperation registers an async operation that completes at readyAt and returns its ID.

func (*RedisProvider) Delete ¶

func (p *RedisProvider) Delete(_ context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*RedisProvider) DeleteResourcesInGroup ¶

func (p *RedisProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*RedisProvider) ExportData ¶

func (p *RedisProvider) ExportData(id ResourceID, body map[string]any) error

ExportData writes the cache's data to a blob container as an RDB file.

func (*RedisProvider) ForceReboot ¶

func (p *RedisProvider) ForceReboot(id ResourceID, body map[string]any) (map[string]any, error)

ForceReboot reboots the selected nodes; see azureredis.Reboot for what survives.

func (*RedisProvider) Get ¶

func (p *RedisProvider) Get(_ context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*RedisProvider) ImportData ¶

func (p *RedisProvider) ImportData(id ResourceID, body map[string]any) error

ImportData loads an RDB blob into the cache.

func (*RedisProvider) List ¶

func (p *RedisProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider; only caches are listable here.

func (*RedisProvider) ListChildren ¶

func (p *RedisProvider) ListChildren(parent ResourceID, childType string) ([]map[string]any, error)

ListChildren lists a cache's firewall rules, patch schedules or linked servers.

func (*RedisProvider) ListKeys ¶

func (p *RedisProvider) ListKeys(_ context.Context, id ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider.

func (*RedisProvider) Namespace ¶

func (p *RedisProvider) Namespace() string

Namespace implements ResourceProvider.

func (*RedisProvider) OperationDone ¶

func (p *RedisProvider) OperationDone(id string) bool

OperationDone reports whether an operation has completed; unknown (aged-out) operations are complete.

func (*RedisProvider) Patch ¶

func (p *RedisProvider) Patch(id ResourceID, body map[string]any) (map[string]any, error)

Patch merges an Update request into an existing cache.

func (*RedisProvider) Put ¶

func (p *RedisProvider) Put(_ context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*RedisProvider) ReadyAt ¶

func (p *RedisProvider) ReadyAt(id ResourceID) time.Time

ReadyAt is when the cache's current provisioning completes.

func (*RedisProvider) RegenerateKey ¶

func (p *RedisProvider) RegenerateKey(id ResourceID, keyType string) (map[string]any, error)

RegenerateKey replaces the Primary or Secondary access key.

func (*RedisProvider) Reset ¶

func (p *RedisProvider) Reset()

Reset implements ResourceProvider.

func (*RedisProvider) ResourceTypes ¶

func (p *RedisProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

type RedisSpec ¶

type RedisSpec struct {
	SKU               string
	MinTLS            string
	Firewall          []RedisIPRange
	Assignments       []RedisAccessAssignment
	EnableNonSSLPort  bool
	Persistence       bool
	AuthNotRequired   bool
	DisableAccessKeys bool
	EntraEnabled      bool
}

RedisSpec is the part of a cache's configuration the Redis servers act on.

type Registry ¶

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

Registry dispatches generic-resource operations to the ResourceProvider registered for a namespace, falling back to InMemoryBackend's own generic (metadata-only) resource storage for any namespace with no dedicated provider -- so PUT/GET/DELETE of an arbitrary Microsoft.SomeFutureThing/whatever resource still round-trips instead of 404ing, per AZURE.md section 10.1's generic-resource-plane requirement.

func NewRegistry ¶

func NewRegistry(backend *InMemoryBackend) *Registry

NewRegistry creates a Registry backed by backend, with no providers registered yet (use Register).

func (*Registry) AutoSwap ¶

func (r *Registry) AutoSwap(ctx context.Context, dpName string) error

AutoSwap swaps the slot dpName into its autoSwapSlotName after a deployment, if one is configured.

func (*Registry) CloseAll ¶

func (r *Registry) CloseAll()

CloseAll stops the workloads of every provider that runs any.

func (*Registry) ContainerRegistryRetention ¶

func (r *Registry) ContainerRegistryRetention(name string) (int, bool)

ContainerRegistryRetention reports the untagged-manifest retention policy of the registry named name: whether it is enabled on a Premium registry, and its period in days.

func (*Registry) Delete ¶

func (r *Registry) Delete(ctx context.Context, id ResourceID) error

Delete removes the resource identified by id.

func (*Registry) DeleteResourcesInGroup ¶

func (r *Registry) DeleteResourcesInGroup(ctx context.Context, resourceGroup string)

DeleteResourcesInGroup cascades a resource-group delete into every registered dedicated provider, so a provider's own resources in that group (e.g. StorageProvider's accounts) don't survive as orphans reachable by their own resource ID after the owning group is gone.

func (*Registry) Get ¶

func (r *Registry) Get(ctx context.Context, id ResourceID) (map[string]any, error)

Get returns the resource identified by id.

func (*Registry) List ¶

func (r *Registry) List(ctx context.Context, id ResourceID) ([]map[string]any, error)

List returns every resource of id's LeafType, scoped per id.ResourceGroup.

func (*Registry) ListKeys ¶

func (r *Registry) ListKeys(ctx context.Context, id ResourceID) (map[string]any, error)

ListKeys returns the listKeys response body for id.

func (*Registry) ProviderNamed ¶

func (r *Registry) ProviderNamed(ns string) (ResourceProvider, bool)

ProviderNamed returns the dedicated ResourceProvider registered for ns (matched case-insensitively, AZURE.md section 10.1), and whether one was found. Used by the /providers/{ns} and /providers/{ns}/register handlers, which take ns directly from the URL path rather than a parsed ResourceID.

func (*Registry) Providers ¶

func (r *Registry) Providers() []string

Providers returns the namespaces of every registered dedicated ResourceProvider, sorted, for the provider-list endpoint.

func (*Registry) Put ¶

func (r *Registry) Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, bool, error)

Put creates or updates the resource identified by id.

func (*Registry) Register ¶

func (r *Registry) Register(p ResourceProvider)

Register adds a ResourceProvider to the registry, keyed by its lowercased Namespace() -- ARM namespaces are matched case-insensitively (AZURE.md section 10.1: "Microsoft.storage" and "microsoft.STORAGE" must both reach the same dedicated provider, not fall through to the generic pass-through).

func (*Registry) ResetAll ¶

func (r *Registry) ResetAll()

ResetAll clears every registered dedicated provider's own state. Called by Handler.Reset alongside InMemoryBackend.Reset -- the generic pass-through resources and dedicated-provider resources (e.g. StorageProvider.accounts) are two separate stores, and the /_gopherstack/reset endpoint must clear both.

func (*Registry) SetACAQueueMeters ¶

func (r *Registry) SetACAQueueMeters(m ACAQueueMeters)

SetACAQueueMeters gives the registered Microsoft.App provider (if any) the queue depths that KEDA queue scale rules and event-driven jobs poll.

func (*Registry) SetACIFileShares ¶

func (r *Registry) SetACIFileShares(s ACIFileShares)

SetACIFileShares gives the registered Microsoft.ContainerInstance provider (if any) the Azure Files seam that azureFile volumes use.

func (*Registry) SetAppConfig ¶

func (r *Registry) SetAppConfig(a AppConfig)

SetAppConfig gives the registered Microsoft.AppConfiguration provider (if any) a real data-plane adapter, replacing its no-op default.

func (*Registry) SetContainerRegistries ¶

func (r *Registry) SetContainerRegistries(c ContainerRegistries)

SetContainerRegistries gives the registered Microsoft.ContainerRegistry provider (if any) a real data-plane adapter, replacing its no-op default.

func (*Registry) SetCosmosResources ¶

func (r *Registry) SetCosmosResources(c CosmosResources)

SetCosmosResources gives the registered Microsoft.DocumentDB provider (if any) a real data-plane adapter, replacing its no-op default.

func (*Registry) SetDiskBlobs ¶

func (r *Registry) SetDiskBlobs(b DiskBlobs)

SetDiskBlobs gives the Compute provider the Blob data plane used by Import and ImportSecure.

func (*Registry) SetEventGrid ¶

func (r *Registry) SetEventGrid(e EventGrid)

SetEventGrid gives the registered Microsoft.EventGrid provider (if any) a real data-plane adapter, replacing its no-op default.

func (*Registry) SetEventHubs ¶

func (r *Registry) SetEventHubs(e EventHubs)

SetEventHubs gives the registered Microsoft.EventHub provider (if any) a real data-plane adapter, replacing its no-op default.

func (*Registry) SetFileServices ¶

func (r *Registry) SetFileServices(fs FileServices)

SetFileServices gives the Microsoft.Storage provider (if any) a data-plane adapter for file service properties.

func (*Registry) SetFileShares ¶

func (r *Registry) SetFileShares(fs FileShares)

SetFileShares gives the Microsoft.Storage provider (if any) the Azure Files data plane.

func (*Registry) SetFunctionApps ¶

func (r *Registry) SetFunctionApps(f FunctionApps)

SetFunctionApps gives the registered Microsoft.Web provider (if any) a real Azure Functions data-plane adapter, replacing its no-op default.

func (*Registry) SetKeyVaultSecrets ¶

func (r *Registry) SetKeyVaultSecrets(v KeyVaultSecrets)

SetKeyVaultSecrets gives the registered Microsoft.App provider (if any) the Key Vault reader that resolves keyVaultUrl secrets.

func (*Registry) SetKeyVaults ¶

func (r *Registry) SetKeyVaults(k KeyVaults)

SetKeyVaults gives the registered Microsoft.KeyVault provider (if any) a real KeyVaults adapter, replacing its no-op default.

func (*Registry) SetMonitorLogs ¶

func (r *Registry) SetMonitorLogs(m MonitorLogs)

SetMonitorLogs gives the registered Microsoft.OperationalInsights and Microsoft.Insights providers (if any) a real data-plane adapter, replacing their no-op default.

func (*Registry) SetRedis ¶

func (r *Registry) SetRedis(rd Redis)

SetRedis gives the registered Microsoft.Cache provider (if any) a real data-plane adapter, replacing its no-op default.

func (*Registry) SetSQL ¶

func (r *Registry) SetSQL(s SQL)

SetSQL gives the registered Microsoft.Sql provider (if any) a real data-plane adapter, replacing its no-op default.

func (*Registry) SetSearch ¶

func (r *Registry) SetSearch(s SearchPlane)

SetSearch gives the registered Microsoft.Search provider (if any) a real data-plane adapter, replacing its no-op default.

func (*Registry) SetServiceBusEntities ¶

func (r *Registry) SetServiceBusEntities(e ServiceBusEntities)

SetServiceBusEntities gives the registered Microsoft.ServiceBus provider (if any) a real ServiceBusEntities adapter, replacing its no-op default -- called post-construction by cli.go's wireAzureARMResourceProviders once services/azureservicebus's own Handler exists, mirroring M8's wireAzureStorageVHost pattern (this can't be wired at azurearm.Provider.Init time the way StorageAccountsProvider is, since it needs a live reference to a sibling service's already-constructed runtime handler). A no-op if Microsoft.ServiceBus isn't registered or isn't a *ServiceBusProvider.

func (*Registry) SiteIdentity ¶

func (r *Registry) SiteIdentity(dpName string) (SiteIdentity, bool)

SiteIdentity returns the managed identity of the data-plane app dpName (name, or name/slot).

func (*Registry) SiteRampUpRules ¶

func (r *Registry) SiteRampUpRules(dpName string) []RampUpRule

SiteRampUpRules returns the traffic routing rules of the production site dpName.

type Resource ¶

type Resource struct {
	Tags       map[string]string
	Properties map[string]any
	SKU        map[string]any
	Location   string
	Kind       string
	ID         ResourceID
}

Resource is the generic stored representation of an ARM resource (any namespace/type not owned by a specific ResourceProvider -- see registry.go's fallback behavior). ResourceProvider implementations (e.g. rp_storage.go) may keep their own richer internal representation and build the wire body directly instead of using this type; Resource exists for the generic pass-through path every namespace gets even without a dedicated RP.

func (Resource) Body ¶

func (r Resource) Body() map[string]any

Body returns the ARM wire response body for r.

type ResourceChange ¶

type ResourceChange struct {
	Time            time.Time
	Claims          map[string]any
	SubscriptionID  string
	ResourceGroup   string
	ResourceURI     string
	Provider        string
	OperationName   string
	CorrelationID   string
	TenantID        string
	HTTPMethod      string
	HTTPURL         string
	ClientRequestID string
	ClientIP        string
	Kind            ResourceChangeKind
}

ResourceChange describes a successful ARM write, delete or action.

type ResourceChangeKind ¶

type ResourceChangeKind int

ResourceChangeKind is the kind of a successful ARM operation.

const (
	ResourceWritten ResourceChangeKind = iota
	ResourceDeleted
	ResourceActionRun
)

Kinds of ResourceChange.

type ResourceGroup ¶

type ResourceGroup struct {
	Tags     map[string]string `json:"tags,omitempty"`
	Name     string            `json:"name"`
	Location string            `json:"location"`
}

ResourceGroup is the stored representation of an ARM resource group.

func (ResourceGroup) Body ¶

func (g ResourceGroup) Body(subscriptionID string) map[string]any

Body returns the ARM wire response body for g, scoped to subscriptionID.

type ResourceID ¶

type ResourceID struct {
	SubscriptionID string
	ResourceGroup  string
	Namespace      string
	Types          []string
	Names          []string
}

ResourceID is a parsed ARM resource identifier of the generic shape /subscriptions/{sub}/resourceGroups/{rg}/providers/{namespace}/{type1}/{name1}[/{type2}/{name2}...].

Types/Names are parallel slices so nested child resources (e.g. Microsoft.ServiceBus/namespaces/{ns}/queues/{q}, two type/name pairs) are represented without a separate "parent" concept -- exactly the single generic path walker AZURE.md section 10.1 requires instead of per-type route registration.

func ParseGenericResourceListPath ¶

func ParseGenericResourceListPath(path string) (ResourceID, bool, error)

ParseGenericResourceListPath parses a resource-type LIST path, either scoped to a resource group:

/subscriptions/{sub}/resourceGroups/{rg}/providers/{ns}/{type}

or across the whole subscription:

/subscriptions/{sub}/providers/{ns}/{type}

Returns the parsed (partial) ResourceID -- Names is empty -- and whether a resource group scope was present.

func ParseGenericResourcePath ¶

func ParseGenericResourcePath(path string) (ResourceID, error)

ParseGenericResourcePath parses a full generic-resource ARM path:

/subscriptions/{sub}/resourceGroups/{rg}/providers/{ns}/{type}/{name}[/{type}/{name}...]

The "resourcegroups"/"resourceGroups" segment is matched case-insensitively per AZURE.md section 10.1 -- real ARM accepts both and azurerm emits both depending on code path.

func (ResourceID) ARMID ¶

func (id ResourceID) ARMID() string

ARMID renders the canonical ARM resource ID string for id, always using the canonical "resourceGroups" casing regardless of what was parsed.

func (ResourceID) LeafName ¶

func (id ResourceID) LeafName() string

LeafName returns the last (innermost) resource name segment -- the name of the resource this ID actually identifies.

func (ResourceID) LeafType ¶

func (id ResourceID) LeafType() string

LeafType returns the last (innermost) resource type segment.

func (ResourceID) ResourceType ¶

func (id ResourceID) ResourceType() string

ResourceType returns the ARM resource type string, e.g. "Microsoft.Storage/storageAccounts" or "Microsoft.ServiceBus/namespaces/queues".

type ResourceObserver ¶

type ResourceObserver interface {
	ResourceChanged(ResourceChange)
}

ResourceObserver is told about every successful ARM write, delete and action.

type ResourceProvider ¶

type ResourceProvider interface {
	// Namespace returns the ARM provider namespace this implementation
	// serves, e.g. "Microsoft.Storage".
	Namespace() string
	// ResourceTypes returns the resource types this provider serves, for
	// the /providers/{ns} registration-status response.
	ResourceTypes() []ResourceTypeDef
	// Put creates or updates the resource identified by id from body,
	// returning the full wire response body.
	Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)
	// Get returns the full wire response body for id.
	Get(ctx context.Context, id ResourceID) (map[string]any, error)
	// Delete removes the resource identified by id.
	Delete(ctx context.Context, id ResourceID) error
	// List returns every resource of id's LeafType, scoped to id's
	// ResourceGroup if set, else the whole subscription.
	List(ctx context.Context, id ResourceID) ([]map[string]any, error)
	// ListKeys returns the POST .../listKeys response body for id.
	ListKeys(ctx context.Context, id ResourceID) (map[string]any, error)
	// Reset clears all of this provider's own state, called by
	// Handler.Reset via Registry.ResetAll (the /_gopherstack/reset
	// endpoint) -- without this, a dedicated provider's resources survive
	// a reset that's supposed to wipe every service's state.
	Reset()
	// DeleteResourcesInGroup deletes every resource this provider owns in
	// resourceGroup, called by Registry.DeleteResourcesInGroup when a
	// resource group is deleted -- without this, a dedicated provider's
	// resources in that group are orphaned (InMemoryBackend's own generic
	// resources are cascaded directly by DeleteResourceGroup, but a
	// dedicated provider's internal state is opaque to InMemoryBackend).
	DeleteResourcesInGroup(ctx context.Context, resourceGroup string)
}

ResourceProvider is the small interface a resource-provider namespace (Microsoft.Storage today; Microsoft.ServiceBus/Microsoft.DocumentDB in M8/M9, Microsoft.KeyVault/Microsoft.AppConfiguration in M11/M12) plugs into the registry with. Deliberately narrow (AZURE.md section 10.6) so each future milestone adds one file and one registry entry.

Put/Get/Delete/ListKeys all return the full ARM wire response body (or nil for Delete's 204 case) -- the ResourceProvider owns its own response shape entirely, including the common id/name/type/location/tags/ properties.provisioningState envelope (Resource.Body / a hand-built equivalent), rather than the registry re-wrapping it.

type ResourceTypeDef ¶

type ResourceTypeDef struct {
	Type        string
	APIVersions []string
	HasChildren bool
}

ResourceTypeDef describes one resource type a ResourceProvider serves -- its type name, supported API versions, and whether it has child resource types nested beneath it (informational only in this MVP; see registry.go).

type SQL ¶

type SQL interface {
	EnsureServer(id string, spec SQLSpec) (SQLEndpoint, error)
	Endpoint(id string) (SQLEndpoint, bool)
	DeleteServer(id string) error
	EnsureDatabase(serverID, name, collation string) error
	DropDatabase(serverID, name string) error
}

SQL is the seam the Microsoft.Sql resource provider uses to run real SQL Server engines for its logical servers. id is the lower-cased ARM resource ID of the server. Primitive types only, so this package never imports services/azuresql.

type SQLEndpoint ¶

type SQLEndpoint struct {
	Host string
	Port int
}

SQLEndpoint is where a server's TDS port listens; Port is 0 while the server is state-only.

type SQLProvider ¶

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

SQLProvider implements ResourceProvider for Microsoft.Sql. ARM keeps the resource metadata and child resources; the SQL Server engines and their databases live behind the SQL seam.

func NewSQLProvider ¶

func NewSQLProvider(dataPlane SQL) *SQLProvider

NewSQLProvider creates a SQLProvider; dataPlane may be nil.

func (*SQLProvider) CreateOperation ¶

func (p *SQLProvider) CreateOperation() string

CreateOperation registers an async operation and returns its ID.

func (*SQLProvider) Delete ¶

func (p *SQLProvider) Delete(_ context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*SQLProvider) DeleteResourcesInGroup ¶

func (p *SQLProvider) DeleteResourcesInGroup(ctx context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*SQLProvider) Get ¶

func (p *SQLProvider) Get(_ context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*SQLProvider) List ¶

func (p *SQLProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider; only servers are listable here, children use ListChildren.

func (*SQLProvider) ListChildren ¶

func (p *SQLProvider) ListChildren(parent ResourceID, childType string) ([]map[string]any, error)

ListChildren lists the children of type childType under a server or database.

func (*SQLProvider) ListKeys ¶

func (p *SQLProvider) ListKeys(context.Context, ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider; SQL servers have no keys.

func (*SQLProvider) Namespace ¶

func (p *SQLProvider) Namespace() string

Namespace implements ResourceProvider.

func (*SQLProvider) OperationKnown ¶

func (p *SQLProvider) OperationKnown(id string) bool

OperationKnown reports whether id was issued by CreateOperation and has not aged out.

func (*SQLProvider) Patch ¶

func (p *SQLProvider) Patch(id ResourceID, body map[string]any) (map[string]any, error)

Patch merges an Update request into an existing server.

func (*SQLProvider) PatchDatabase ¶

func (p *SQLProvider) PatchDatabase(id ResourceID, body map[string]any) (map[string]any, error)

PatchDatabase merges an Update request into an existing database.

func (*SQLProvider) Put ¶

func (p *SQLProvider) Put(_ context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*SQLProvider) Reset ¶

func (p *SQLProvider) Reset()

Reset implements ResourceProvider.

func (*SQLProvider) ResourceTypes ¶

func (p *SQLProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

type SQLSpec ¶

type SQLSpec struct {
	AdminLogin    string
	AdminPassword string
}

SQLSpec is the part of a logical server's configuration the SQL Server engine acts on. An empty AdminPassword keeps the current one.

type SearchAdminKeys ¶

type SearchAdminKeys struct {
	Primary   string
	Secondary string
}

SearchAdminKeys is a service's admin key pair.

type SearchEndpointConfig ¶

type SearchEndpointConfig struct {
	Override string
	Port     int
}

SearchEndpointConfig configures the endpoints the provider advertises.

type SearchPlane ¶

type SearchPlane interface {
	PutService(name string, cfg SearchServiceConfig) (time.Time, error)
	DeleteService(name string) error
	AdminKeys(name string) (SearchAdminKeys, error)
	RegenerateAdminKey(name, kind string) (SearchAdminKeys, error)
	QueryKeys(name string) ([]SearchQueryKey, error)
	CreateQueryKey(name, keyName string) (SearchQueryKey, error)
	DeleteQueryKey(name, key string) error
	Port() int
	EncryptionCompliance(name string) string
}

SearchPlane is the seam the Microsoft.Search provider uses to keep services and their keys in the Azure AI Search data plane.

type SearchProvider ¶

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

SearchProvider implements ResourceProvider for Microsoft.Search. ARM keeps location, tags, SKU, capacity and unmodelled properties; services and keys live in the data plane.

func NewSearchProvider ¶

func NewSearchProvider(cfg SearchEndpointConfig, dataPlane SearchPlane) *SearchProvider

NewSearchProvider creates a SearchProvider; dataPlane may be nil.

func (*SearchProvider) AdminKeys ¶

func (p *SearchProvider) AdminKeys(id ResourceID, kind string) (SearchAdminKeys, error)

AdminKeys returns the service's admin keys, regenerating the named one first when kind is set.

func (*SearchProvider) CheckName ¶

func (p *SearchProvider) CheckName(name string) map[string]any

CheckName reports whether name is a valid, unused search service name.

func (*SearchProvider) CreateQueryKey ¶

func (p *SearchProvider) CreateQueryKey(id ResourceID, name string) (SearchQueryKey, error)

CreateQueryKey creates a named query key.

func (*SearchProvider) Delete ¶

func (p *SearchProvider) Delete(_ context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*SearchProvider) DeleteQueryKey ¶

func (p *SearchProvider) DeleteQueryKey(id ResourceID, key string) error

DeleteQueryKey deletes a query key by its value.

func (*SearchProvider) DeleteResourcesInGroup ¶

func (p *SearchProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (p *SearchProvider) DeleteSharedLink(id ResourceID, name string) error

DeleteSharedLink removes a shared private link resource.

func (*SearchProvider) Get ¶

func (p *SearchProvider) Get(_ context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (p *SearchProvider) GetSharedLink(id ResourceID, name string) (map[string]any, error)

GetSharedLink returns one shared private link resource.

func (*SearchProvider) List ¶

func (p *SearchProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider.

func (*SearchProvider) ListKeys ¶

func (p *SearchProvider) ListKeys(_ context.Context, id ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider; search keys use listAdminKeys/listQueryKeys instead.

func (*SearchProvider) ListQueryKeys ¶

func (p *SearchProvider) ListQueryKeys(id ResourceID) ([]SearchQueryKey, error)

ListQueryKeys lists the service's query keys.

func (p *SearchProvider) ListSharedLinks(id ResourceID) ([]any, error)

ListSharedLinks lists a service's shared private link resources.

func (*SearchProvider) Namespace ¶

func (p *SearchProvider) Namespace() string

Namespace implements ResourceProvider.

func (*SearchProvider) Patch ¶

func (p *SearchProvider) Patch(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Patch merges a partial update (the Update operation) into an existing service.

func (*SearchProvider) Put ¶

func (p *SearchProvider) Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (p *SearchProvider) PutSharedLink(id ResourceID, name string, body map[string]any) (map[string]any, error)

PutSharedLink creates or updates a shared private link resource. A new link starts Pending: approval happens on the target resource, which this emulator does not do.

func (*SearchProvider) Reset ¶

func (p *SearchProvider) Reset()

Reset implements ResourceProvider.

func (*SearchProvider) ResourceTypes ¶

func (p *SearchProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*SearchProvider) Upgrade ¶

func (p *SearchProvider) Upgrade(id ResourceID) (map[string]any, error)

Upgrade applies the pending service upgrade: the service reports no further upgrade and the time it was upgraded.

func (*SearchProvider) Usages ¶

func (p *SearchProvider) Usages(subscription, location, sku string) ([]map[string]any, error)

Usages reports per-SKU service counts in the subscription against the SKU quota; sku narrows the result.

type SearchQueryKey ¶

type SearchQueryKey struct {
	Name string
	Key  string
}

SearchQueryKey is one query key of a search service; Name may be empty.

type SearchServiceConfig ¶

type SearchServiceConfig struct {
	SKU                 string
	HostingMode         string
	PublicNetworkAccess string
	AuthMode            string
	AADFailureMode      string
	ResourceID          string
	CMKEnforcement      string
	IPRules             []string
	ReplicaCount        int
	PartitionCount      int
	DisableLocalAuth    bool
}

SearchServiceConfig is what ARM tells the data plane about a search service.

type ServiceBusEndpointConfig ¶

type ServiceBusEndpointConfig struct {
	Override string
	Port     int
}

ServiceBusEndpointConfig configures how the ServiceBus resource provider advertises the namespace's serviceBusEndpoint. Unlike Storage's StorageEndpointConfig, this needs no vhost/shared-port scheme: services/azureservicebus has no namespace-in-URL routing at all (a flat host:port reaches it directly), so a single scalar override suffices.

type ServiceBusEntities ¶

type ServiceBusEntities interface {
	CreateQueue(name string, lockDuration, defaultMessageTTL time.Duration, maxDeliveryCount int) error
	DeleteQueue(name string) error
	QueueExists(name string) bool

	CreateTopic(name string, defaultMessageTTL time.Duration) error
	DeleteTopic(name string) error
	TopicExists(name string) bool

	CreateSubscription(topic, name string, lockDuration time.Duration, maxDeliveryCount int) error
	DeleteSubscription(topic, name string) error
	SubscriptionExists(topic, name string) bool
}

ServiceBusEntities is the narrow, consumer-defined seam the Microsoft.ServiceBus resource provider (rp_servicebus.go) delegates queue/topic/subscription lifecycle through, mirroring StorageAccounts's shape above. Uses only primitive types (time.Duration, int, string) rather than services/azureservicebus's own EntityConfig, so this package never imports a data-plane service package (AZURE.md section 10.6) -- the real adapter translating these calls into azureservicebus.EntityConfig lives in cli_adapters.go, which already imports across services.

Unlike StorageAccounts, ServiceBusEntities calls are load-bearing for M9's test plan: services/azureservicebus (M5) is one-process-one-namespace with no ARM-shaped state of its own, so a Terraform-created queue/topic/ subscription must actually exist in the real M5 backend for the REST send->peek-lock->complete liveness round-trip to succeed -- this is not an optional best-effort hook the way Storage's RegisterAccount is.

type ServiceBusPortProvider ¶

type ServiceBusPortProvider interface {
	GetAzureServiceBusPort() int
}

ServiceBusPortProvider is a private interface AppContext.Config may implement to expose the actual services/azureservicebus listener's configured port, so Init can cross-check it against Settings.ServiceBusPort. cli.go implements this via CLI.GetAzureServiceBusPort.

type ServiceBusProvider ¶

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

ServiceBusProvider implements ResourceProvider for Microsoft.ServiceBus. Unlike StorageProvider, its queue/topic/subscription Put calls ARE load-bearing against dataPlane (services/azureservicebus, M5) -- M5 has no ARM-shaped state of its own, so a Terraform-created entity must genuinely exist in the real backend for AZURE.md's M9 test plan (a REST send->peek-lock->complete round-trip) to succeed. Namespace Put is metadata-only: M5 is one-process-one-namespace, so there's nothing to delegate for "creating" one.

func NewServiceBusProvider ¶

func NewServiceBusProvider(cfg ServiceBusEndpointConfig, dataPlane ServiceBusEntities) *ServiceBusProvider

NewServiceBusProvider creates a ServiceBusProvider. dataPlane may be nil, in which case a no-op default is used (see interfaces.go) until cli.go's wireAzureARMResourceProviders wires a real one post-construction.

func (*ServiceBusProvider) Delete ¶

func (p *ServiceBusProvider) Delete(ctx context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*ServiceBusProvider) DeleteResourcesInGroup ¶

func (p *ServiceBusProvider) DeleteResourcesInGroup(ctx context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider (Registry's cascade delete when a resource group is deleted).

func (*ServiceBusProvider) Get ¶

Get implements ResourceProvider.

func (*ServiceBusProvider) List ¶

func (p *ServiceBusProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider, scoped to id.ResourceGroup if set, else every resource of id's LeafType in the subscription.

func (*ServiceBusProvider) ListKeys ¶

func (p *ServiceBusProvider) ListKeys(_ context.Context, id ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider for namespaces/{ns}/authorizationRules/{rule}/listKeys. Response shape -- {"primaryConnectionString","secondaryConnectionString","primaryKey", "secondaryKey","keyName"} -- matches real ARM's Service Bus AuthorizationRules ListKeys AccessKeys model. This emulator has exactly one fixed dev SAS identity (services/azureservicebus/sas.go's DefaultKeyName/DefaultKeyValue, mirrored here as sbDefaultKeyName/ sbDefaultKeyValue), so both primary/secondary key are the same value -- matching StorageProvider.ListKeys's identical key1/key2 convention.

func (*ServiceBusProvider) Namespace ¶

func (p *ServiceBusProvider) Namespace() string

Namespace implements ResourceProvider.

func (*ServiceBusProvider) Put ¶

func (p *ServiceBusProvider) Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*ServiceBusProvider) Reset ¶

func (p *ServiceBusProvider) Reset()

Reset implements ResourceProvider (Registry.ResetAll, the /_gopherstack/reset endpoint).

func (*ServiceBusProvider) ResourceTypes ¶

func (p *ServiceBusProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

type Settings ¶

type Settings struct {
	ACIEngine string `` //nolint:lll // config struct tags are intentionally verbose
	/* 404-byte string literal not displayed */
	AKSEngine string `` //nolint:lll // config struct tags are intentionally verbose
	/* 406-byte string literal not displayed */
	ClientID string `` //nolint:lll // config struct tags are intentionally verbose
	/* 198-byte string literal not displayed */
	ClientSecret string `` //nolint:lll // config struct tags are intentionally verbose
	/* 249-byte string literal not displayed */
	Environment string `` //nolint:lll // config struct tags are intentionally verbose
	/* 270-byte string literal not displayed */
	Location string `` //nolint:lll // config struct tags are intentionally verbose
	/* 229-byte string literal not displayed */
	AdvertiseStorageVHost string `` //nolint:lll // config struct tags are intentionally verbose
	/* 357-byte string literal not displayed */
	TLSCertFile string `` //nolint:lll // config struct tags are intentionally verbose
	/* 311-byte string literal not displayed */
	TLSKeyFile string `` //nolint:lll // config struct tags are intentionally verbose
	/* 253-byte string literal not displayed */
	FlexDumpDir string `` //nolint:lll // config struct tags are intentionally verbose
	/* 346-byte string literal not displayed */
	AdvertiseServiceBus string `` //nolint:lll // config struct tags are intentionally verbose
	/* 290-byte string literal not displayed */
	AdvertiseKeyVault string `` //nolint:lll // config struct tags are intentionally verbose
	/* 306-byte string literal not displayed */
	AdvertiseCosmosDB string `` //nolint:lll // config struct tags are intentionally verbose
	/* 290-byte string literal not displayed */
	AdvertiseEventHub string `` //nolint:lll // config struct tags are intentionally verbose
	/* 325-byte string literal not displayed */
	AdvertiseEventGrid string `` //nolint:lll // config struct tags are intentionally verbose
	/* 321-byte string literal not displayed */
	AdvertiseAppConfig string `` //nolint:lll // config struct tags are intentionally verbose
	/* 328-byte string literal not displayed */
	AdvertiseSearch string `` //nolint:lll // config struct tags are intentionally verbose
	/* 294-byte string literal not displayed */
	AdvertiseACR string `` //nolint:lll // config struct tags are intentionally verbose
	/* 334-byte string literal not displayed */
	SubscriptionID string `` //nolint:lll // config struct tags are intentionally verbose
	/* 192-byte string literal not displayed */
	DBEngine string `` //nolint:lll // config struct tags are intentionally verbose
	/* 406-byte string literal not displayed */
	TenantID string `` //nolint:lll // config struct tags are intentionally verbose
	/* 227-byte string literal not displayed */
	AdvertiseGraph string `` //nolint:lll // config struct tags are intentionally verbose
	/* 311-byte string literal not displayed */
	RBACSuperusers string `` //nolint:lll // config struct tags are intentionally verbose
	/* 274-byte string literal not displayed */
	Port int `` //nolint:lll // config struct tags are intentionally verbose
	/* 260-byte string literal not displayed */
	ServiceBusPort int `` //nolint:lll // config struct tags are intentionally verbose
	/* 323-byte string literal not displayed */
	KeyVaultPort int `` //nolint:lll // config struct tags are intentionally verbose
	/* 307-byte string literal not displayed */
	EventHubPort int `` //nolint:lll // config struct tags are intentionally verbose
	/* 273-byte string literal not displayed */
	EventHubAMQPPort int `` //nolint:lll // config struct tags are intentionally verbose
	/* 324-byte string literal not displayed */
	ACRPort int `` //nolint:lll // config struct tags are intentionally verbose
	/* 309-byte string literal not displayed */
	StorageVHostPort int `` //nolint:lll // config struct tags are intentionally verbose
	/* 336-byte string literal not displayed */
	GraphPort int `` //nolint:lll // config struct tags are intentionally verbose
	/* 332-byte string literal not displayed */
	EventGridPort int `` //nolint:lll // config struct tags are intentionally verbose
	/* 323-byte string literal not displayed */
	AppConfigPort int `` //nolint:lll // config struct tags are intentionally verbose
	/* 323-byte string literal not displayed */
	APIMAllowExternal bool `` //nolint:lll // config struct tags are intentionally verbose
	/* 301-byte string literal not displayed */
	LogicAllowExternal bool `` //nolint:lll // config struct tags are intentionally verbose
	/* 291-byte string literal not displayed */
	ValidatePrincipals bool `` //nolint:lll // config struct tags are intentionally verbose
	/* 386-byte string literal not displayed */
	ValidateTokens bool `` //nolint:lll // config struct tags are intentionally verbose
	/* 258-byte string literal not displayed */
	EnforceRBAC bool `` //nolint:lll // config struct tags are intentionally verbose
	/* 387-byte string literal not displayed */
}

Settings holds service-level configuration for the ARM emulation backend. Fields are picked up by the Kong CLI parser when embedded in the root CLI command (see cli.go's CLI.AzureARM field), mirroring services/cosmosdb's Settings pattern. Field order below is grouped by type (all strings, then all ints, then the bool) rather than by topic, to satisfy govet's fieldalignment check -- interleaving AdvertiseServiceBus (a string) between the int fields, as a topic-grouped order would, widens the struct's leading run of pointer-containing fields from 152 to 168 bytes. Safe to reorder: every construction of Settings (DefaultSettings, and Kong's tag-driven parsing) uses field names, never positional literals.

func DefaultSettings ¶

func DefaultSettings() Settings

DefaultSettings returns the default Settings. Used when no ConfigProvider is available at init time (e.g. tests constructing a Provider directly).

type SiteIdentity ¶

type SiteIdentity struct {
	TenantID          string
	SystemPrincipalID string
	User              []SiteUserIdentity
}

SiteIdentity is the managed identity of a site or slot as the app's local token service needs it.

type SiteUserIdentity ¶

type SiteUserIdentity struct {
	ResourceID  string
	ClientID    string
	PrincipalID string
}

SiteUserIdentity is a user-assigned identity attached to a site.

type StorageAccounts ¶

type StorageAccounts interface {
	// RegisterAccount is called when the Storage RP creates a new storage
	// account. A nil-safe no-op default (noopStorageAccounts) is used when no
	// real adapter is wired, so services/azurearm works standalone in unit
	// tests and degrades gracefully if the data plane is disabled.
	RegisterAccount(name string) error
	// DeleteAccount is called when the Storage RP deletes a storage account.
	DeleteAccount(name string) error
}

StorageAccounts is the narrow, consumer-defined seam the Microsoft.Storage resource provider (rp_storage.go) delegates account lifecycle events through, mirroring the wireCrossServiceDependencies adapter pattern cli_adapters.go already uses ~60 times for AWS (see AZURE.md section 10.6). It is declared here even though M7's Storage RP does not need it to serve Blob/Queue/Table traffic today (those backends are already account-name-agnostic -- AZURE.md section 10.4) -- so that M10's per-account namespacing (RegisterAccount/DeleteAccount keying each data plane's top-level map by account name) is additive: rp_storage.go already calls these hooks, they're just no-ops until M10 wires a real adapter in cli_adapters.go.

CosmosResources (M10's equivalent) is deliberately NOT declared here yet -- AZURE.md's own scope note prefers keeping this milestone's interface surface to what it actually uses, over speculatively declaring shapes for resource providers this milestone doesn't implement. ServiceBusEntities below is M9's version of the same pattern, now that M9 actually needs it.

type StorageAccountsProvider ¶

type StorageAccountsProvider interface {
	GetAzureARMStorageAccounts() StorageAccounts
}

StorageAccountsProvider is a private interface AppContext.Config may implement to supply a real StorageAccounts adapter (wired by cli.go's wireCrossServiceDependencies in a future milestone -- see interfaces.go). Absent (the common case for M7), NewStorageProvider falls back to the nil-safe noopStorageAccounts default.

type StorageEndpointConfig ¶

type StorageEndpointConfig struct {
	VHostOverride string
	VHostPort     int
}

StorageEndpointConfig configures how the Storage resource provider advertises Blob/Queue/Table data-plane endpoints in properties.primaryEndpoints, per AZURE.md section 10.4's endpoint-advertisement design. VHostOverride/VHostPort replace this struct's earlier three separate per-service overrides/ports (Blob/Queue/Table): terraform-provider-azurerm's data-plane SDK requires Blob/Queue/Table to share one domain suffix for account-ID parsing, and since Go's url.URL.Host always includes the port, that forces them onto one shared port too -- see services/azurestoragevhost's package doc comment and AZURE.md section 10.8 for the full derivation. advertiseVHostEndpoint below is the only thing that reads these.

type StorageProvider ¶

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

StorageProvider implements ResourceProvider for Microsoft.Storage. Per AZURE.md section 10.4, it is metadata-only: Blob/Queue/Table are already account-name-agnostic, so no data-plane delegation is required for an ARM-created account to be immediately usable. StorageAccounts (accounts StorageAccounts interface) is called best-effort for forward-compat with M10's per-account namespacing.

func NewStorageProvider ¶

func NewStorageProvider(cfg StorageEndpointConfig, dataPlane StorageAccounts) *StorageProvider

NewStorageProvider creates a StorageProvider. dataPlane may be nil, in which case a no-op default is used (see interfaces.go).

func (*StorageProvider) AccountSKUName ¶

func (p *StorageProvider) AccountSKUName(account string) (string, bool)

AccountSKUName returns the SKU name (for example Premium_LRS) of the storage account with this name.

func (*StorageProvider) Delete ¶

func (p *StorageProvider) Delete(ctx context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*StorageProvider) DeleteResourcesInGroup ¶

func (p *StorageProvider) DeleteResourcesInGroup(ctx context.Context, resourceGroup string)

DeleteResourcesInGroup implements the cascade-delete hook Registry.DeleteResourcesInGroup calls when a resource group is deleted (CodeRabbit-flagged: DELETE .../resourceGroups/{name} previously only cleared InMemoryBackend's generic resources, leaving StorageProvider accounts in that group orphaned but still reachable).

func (*StorageProvider) Get ¶

func (p *StorageProvider) Get(_ context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*StorageProvider) List ¶

func (p *StorageProvider) List(_ context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider, scoped to id.ResourceGroup if set (per the ResourceProvider interface contract), else every account in the subscription.

func (*StorageProvider) ListKeys ¶

func (p *StorageProvider) ListKeys(_ context.Context, id ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider. The response shape -- {"keys":[{"keyName","value","permissions"}, ...]} -- was verified against the real ARM "Storage Accounts - List Keys" REST API documentation (learn.microsoft.com/en-us/rest/api/storagerp/storage-accounts/list-keys): StorageAccountListKeysResult.keys is a StorageAccountKey[] with exactly those three fields, "permissions" taking the KeyPermission enum value "Full" (not "FULL"). Key values are pkgs/azureauth's well-known devstoreaccount1 development key, matching every other Azure service's well-known-credential convention.

func (*StorageProvider) Namespace ¶

func (p *StorageProvider) Namespace() string

Namespace implements ResourceProvider.

func (*StorageProvider) Put ¶

func (p *StorageProvider) Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider: creates or updates a storage account.

func (*StorageProvider) Reset ¶

func (p *StorageProvider) Reset()

Reset implements the reset hook Registry.ResetAll calls across every registered provider (Handler.Reset -- CodeRabbit-flagged: without this, accounts created before a /_gopherstack/reset survived it, since only InMemoryBackend was being cleared).

func (*StorageProvider) ResourceTypes ¶

func (p *StorageProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

type TokenResponse ¶

type TokenResponse struct {
	TokenType   string `json:"token_type"`
	AccessToken string `json:"access_token"`
	ExpiresIn   int    `json:"expires_in"`
}

TokenResponse is the client-credentials grant response body, for both the v1 (/{tenant}/oauth2/token) and v2 (/{tenant}/oauth2/v2.0/token) endpoints -- AZURE.md section 10.1 specifies the identical body shape for both.

func IssueToken ¶

func IssueToken(issuer *aadauth.Issuer, baseURL, tenant, clientID, scopeOrResource string) (TokenResponse, error)

IssueToken issues a client-credentials access token for tenant, using issuer, returning the wire response body.

func IssueTokenForObject ¶

func IssueTokenForObject(
	issuer *aadauth.Issuer, baseURL, tenant, clientID, objectID, scopeOrResource string,
) (TokenResponse, error)

IssueTokenForObject is IssueToken with an explicit oid/sub claim, the client's service principal object ID.

type VHostPortProvider ¶

type VHostPortProvider interface {
	GetAzureStorageVHostPort() int
}

VHostPortProvider is a private interface AppContext.Config may implement to expose the actual services/azurestoragevhost listener's configured port, so Init can cross-check it against Settings.StorageVHostPort. cli.go implements this via CLI.GetAzureStorageVHostPort.

type WebProvider ¶

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

WebProvider implements ResourceProvider for Microsoft.Web function apps and their hosting plans. ARM keeps location, tags, plan links, and site configuration; the app itself (settings, keys, package, host) lives in the Azure Functions data plane.

func NewWebProvider ¶

func NewWebProvider(dataPlane FunctionApps) *WebProvider

NewWebProvider creates a WebProvider; dataPlane may be nil.

func (*WebProvider) ApplySlotConfig ¶

func (p *WebProvider) ApplySlotConfig(ctx context.Context, id ResourceID, body map[string]any) error

ApplySlotConfig serves POST .../applySlotConfig: the first phase of a swap with preview.

func (*WebProvider) CheckName ¶

func (p *WebProvider) CheckName(name string) map[string]any

CheckName answers POST /subscriptions/{sub}/providers/Microsoft.Web/checknameavailability.

func (*WebProvider) Delete ¶

func (p *WebProvider) Delete(_ context.Context, id ResourceID) error

Delete implements ResourceProvider.

func (*WebProvider) DeleteFunction ¶

func (p *WebProvider) DeleteFunction(ctx context.Context, id ResourceID, fn string) error

DeleteFunction serves DELETE .../functions/{fn}.

func (*WebProvider) DeleteFunctionKey ¶

func (p *WebProvider) DeleteFunctionKey(ctx context.Context, id ResourceID, fn, keyName string) error

DeleteFunctionKey serves DELETE .../functions/{fn}/keys/{name}.

func (*WebProvider) DeleteHostKey ¶

func (p *WebProvider) DeleteHostKey(_ context.Context, id ResourceID, keyType, keyName string) error

DeleteHostKey serves DELETE .../host/default/{keyType}/{name}.

func (*WebProvider) DeleteResourcesInGroup ¶

func (p *WebProvider) DeleteResourcesInGroup(_ context.Context, resourceGroup string)

DeleteResourcesInGroup implements ResourceProvider.

func (*WebProvider) FunctionKeys ¶

func (p *WebProvider) FunctionKeys(ctx context.Context, id ResourceID, fn string) (map[string]any, error)

FunctionKeys serves POST .../functions/{fn}/listkeys.

func (*WebProvider) FunctionSecrets ¶

func (p *WebProvider) FunctionSecrets(ctx context.Context, id ResourceID, fn string) (map[string]any, error)

FunctionSecrets serves POST .../functions/{fn}/listsecrets.

func (*WebProvider) FunctionsAdminToken ¶

func (p *WebProvider) FunctionsAdminToken(id ResourceID) (string, error)

FunctionsAdminToken serves GET .../functions/admin/token.

func (*WebProvider) Get ¶

func (p *WebProvider) Get(ctx context.Context, id ResourceID) (map[string]any, error)

Get implements ResourceProvider.

func (*WebProvider) GetConfig ¶

func (p *WebProvider) GetConfig(_ context.Context, id ResourceID, name string) (map[string]any, error)

GetConfig serves GET and POST .../config/{name}[/list].

func (*WebProvider) GetFunction ¶

func (p *WebProvider) GetFunction(ctx context.Context, id ResourceID, fn string) (map[string]any, error)

GetFunction serves GET .../functions/{fn}.

func (*WebProvider) HostKeys ¶

func (p *WebProvider) HostKeys(_ context.Context, id ResourceID) (map[string]any, error)

HostKeys serves POST .../host/default/listkeys.

func (*WebProvider) List ¶

func (p *WebProvider) List(ctx context.Context, id ResourceID) ([]map[string]any, error)

List implements ResourceProvider.

func (*WebProvider) ListFunctions ¶

func (p *WebProvider) ListFunctions(ctx context.Context, id ResourceID) ([]map[string]any, error)

ListFunctions serves GET .../functions.

func (*WebProvider) ListKeys ¶

func (p *WebProvider) ListKeys(_ context.Context, id ResourceID) (map[string]any, error)

ListKeys implements ResourceProvider: POST .../sites/{name}/host/default/listkeys is routed here by type.

func (*WebProvider) ListSlots ¶

func (p *WebProvider) ListSlots(ctx context.Context, id ResourceID) ([]map[string]any, error)

ListSlots serves GET .../sites/{name}/slots.

func (*WebProvider) Namespace ¶

func (p *WebProvider) Namespace() string

Namespace implements ResourceProvider.

func (*WebProvider) Patch ¶

func (p *WebProvider) Patch(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Patch serves PATCH on a site: properties are merged over the stored ones.

func (*WebProvider) Policy ¶

func (p *WebProvider) Policy(
	_ context.Context, id ResourceID, name string, body map[string]any, put bool,
) (map[string]any, error)

Policy serves GET and PUT .../basicPublishingCredentialsPolicies/{ftp|scm}.

func (*WebProvider) PublishXML ¶

func (p *WebProvider) PublishXML(_ context.Context, id ResourceID) ([]byte, error)

PublishXML serves POST .../publishxml: a ZipDeploy profile that points at the app's Kudu site.

func (*WebProvider) PublishingCredentials ¶

func (p *WebProvider) PublishingCredentials(_ context.Context, id ResourceID) (map[string]any, error)

PublishingCredentials serves POST .../config/publishingcredentials/list.

func (*WebProvider) Put ¶

func (p *WebProvider) Put(ctx context.Context, id ResourceID, body map[string]any) (map[string]any, error)

Put implements ResourceProvider.

func (*WebProvider) PutConfig ¶

func (p *WebProvider) PutConfig(
	_ context.Context, id ResourceID, name string, body map[string]any, merge bool,
) (map[string]any, error)

PutConfig serves PUT (replace) and PATCH (merge) .../config/{name}.

func (*WebProvider) Reset ¶

func (p *WebProvider) Reset()

Reset implements ResourceProvider.

func (*WebProvider) ResetSlotConfig ¶

func (p *WebProvider) ResetSlotConfig(_ context.Context, id ResourceID) error

ResetSlotConfig serves POST .../resetSlotConfig: it cancels a swap with preview.

func (*WebProvider) ResourceTypes ¶

func (p *WebProvider) ResourceTypes() []ResourceTypeDef

ResourceTypes implements ResourceProvider.

func (*WebProvider) SetFunctionKey ¶

func (p *WebProvider) SetFunctionKey(
	ctx context.Context, id ResourceID, fn, keyName string, body map[string]any,
) (map[string]any, error)

SetFunctionKey serves PUT .../functions/{fn}/keys/{name}.

func (*WebProvider) SetHostKey ¶

func (p *WebProvider) SetHostKey(
	_ context.Context, id ResourceID, keyType, keyName string, body map[string]any,
) (map[string]any, error)

SetHostKey serves PUT .../host/default/{keyType}/{name}.

func (*WebProvider) SetState ¶

func (p *WebProvider) SetState(_ context.Context, id ResourceID, action string) error

SetState serves POST .../start, .../stop and .../restart.

func (*WebProvider) SlotDifferences ¶

func (p *WebProvider) SlotDifferences(_ context.Context, id ResourceID, body map[string]any) ([]map[string]any, error)

SlotDifferences serves POST .../slotsdiffs: the swapped settings whose values differ between the slots.

func (*WebProvider) SwapSlots ¶

func (p *WebProvider) SwapSlots(ctx context.Context, id ResourceID, body map[string]any) error

SwapSlots serves POST .../slotsswap: a full swap, or the completion of a swap with preview.

func (*WebProvider) SyncFunctionTriggers ¶

func (p *WebProvider) SyncFunctionTriggers(ctx context.Context, id ResourceID) error

SyncFunctionTriggers serves POST .../syncfunctiontriggers.

Source Files ¶

Jump to

Keyboard shortcuts

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