From adf547ed884753929e596f465a5e24dd35e26b00 Mon Sep 17 00:00:00 2001 From: ytimocin Date: Mon, 13 Oct 2025 21:26:52 -0700 Subject: [PATCH] Add env terraform/bicep settings schema Signed-off-by: ytimocin --- hack/bicep-types-radius/generated/index.json | 10 +- .../radius.core/2025-08-01-preview/types.json | 960 +++++++++++++++--- .../environment_conversion.go | 20 + .../environment_conversion_test.go | 10 +- .../zz_generated_bicepsettings_client.go | 308 ++++++ .../zz_generated_client_factory.go | 16 + .../zz_generated_constants.go | 24 + .../v20250801preview/zz_generated_models.go | 249 +++++ .../zz_generated_models_serde.go | 723 +++++++++++++ .../v20250801preview/zz_generated_options.go | 53 + .../zz_generated_responses.go | 58 ++ .../zz_generated_terraformsettings_client.go | 310 ++++++ .../bicepsettings_v20250801preview.go | 72 ++ .../datamodel/environment_v20250801preview.go | 6 + pkg/corerp/datamodel/recipe_types.go | 101 ++ .../terraformsettings_v20250801preview.go | 103 ++ .../preview/2025-08-01-preview/openapi.json | 916 ++++++++++++++++- typespec/Radius.Core/bicepSettings.tsp | 135 +++ typespec/Radius.Core/environments.tsp | 6 + typespec/Radius.Core/main.tsp | 2 + typespec/Radius.Core/terraformSettings.tsp | 170 ++++ 21 files changed, 4091 insertions(+), 161 deletions(-) create mode 100644 pkg/corerp/api/v20250801preview/zz_generated_bicepsettings_client.go create mode 100644 pkg/corerp/api/v20250801preview/zz_generated_terraformsettings_client.go create mode 100644 pkg/corerp/datamodel/bicepsettings_v20250801preview.go create mode 100644 pkg/corerp/datamodel/terraformsettings_v20250801preview.go create mode 100644 typespec/Radius.Core/bicepSettings.tsp create mode 100644 typespec/Radius.Core/terraformSettings.tsp diff --git a/hack/bicep-types-radius/generated/index.json b/hack/bicep-types-radius/generated/index.json index ce8975f362..9016fcb9c8 100644 --- a/hack/bicep-types-radius/generated/index.json +++ b/hack/bicep-types-radius/generated/index.json @@ -48,11 +48,17 @@ "Radius.Core/applications@2025-08-01-preview": { "$ref": "radius/radius.core/2025-08-01-preview/types.json#/44" }, + "Radius.Core/bicepSettings@2025-08-01-preview": { + "$ref": "radius/radius.core/2025-08-01-preview/types.json#/65" + }, "Radius.Core/environments@2025-08-01-preview": { - "$ref": "radius/radius.core/2025-08-01-preview/types.json#/64" + "$ref": "radius/radius.core/2025-08-01-preview/types.json#/85" }, "Radius.Core/recipePacks@2025-08-01-preview": { - "$ref": "radius/radius.core/2025-08-01-preview/types.json#/87" + "$ref": "radius/radius.core/2025-08-01-preview/types.json#/108" + }, + "Radius.Core/terraformSettings@2025-08-01-preview": { + "$ref": "radius/radius.core/2025-08-01-preview/types.json#/144" } }, "resourceFunctions": {}, diff --git a/hack/bicep-types-radius/generated/radius/radius.core/2025-08-01-preview/types.json b/hack/bicep-types-radius/generated/radius/radius.core/2025-08-01-preview/types.json index 5594669aee..f18b62abe9 100644 --- a/hack/bicep-types-radius/generated/radius/radius.core/2025-08-01-preview/types.json +++ b/hack/bicep-types-radius/generated/radius/radius.core/2025-08-01-preview/types.json @@ -541,7 +541,7 @@ }, { "$type": "StringLiteralType", - "value": "Radius.Core/environments" + "value": "Radius.Core/bicepSettings" }, { "$type": "StringLiteralType", @@ -549,7 +549,7 @@ }, { "$type": "ObjectType", - "name": "Radius.Core/environments", + "name": "Radius.Core/bicepSettings", "properties": { "id": { "type": { @@ -584,11 +584,11 @@ "$ref": "#/48" }, "flags": 1, - "description": "Environment properties" + "description": "Bicep settings properties." }, "tags": { "type": { - "$ref": "#/63" + "$ref": "#/64" }, "flags": 0, "description": "Resource tags." @@ -611,7 +611,7 @@ }, { "$type": "ObjectType", - "name": "EnvironmentProperties", + "name": "BicepSettingsProperties", "properties": { "provisioningState": { "type": { @@ -620,25 +620,12 @@ "flags": 2, "description": "Provisioning state of the resource at the time the operation was called" }, - "recipePacks": { + "authentication": { "type": { "$ref": "#/58" }, "flags": 0, - "description": "List of Recipe Pack resource IDs linked to this environment." - }, - "providers": { - "type": { - "$ref": "#/59" - }, - "flags": 0 - }, - "simulated": { - "type": { - "$ref": "#/30" - }, - "flags": 0, - "description": "Simulated environment." + "description": "Authentication configuration for Bicep registries." } } }, @@ -704,90 +691,120 @@ ] }, { - "$type": "ArrayType", - "itemType": { - "$ref": "#/0" + "$type": "ObjectType", + "name": "BicepAuthenticationConfiguration", + "properties": { + "registries": { + "type": { + "$ref": "#/63" + }, + "flags": 0, + "description": "Authentication entries keyed by registry hostname." + } } }, { "$type": "ObjectType", - "name": "Providers", + "name": "BicepRegistryAuthentication", "properties": { - "azure": { + "basic": { "type": { "$ref": "#/60" }, "flags": 0, - "description": "The Azure cloud provider definition." + "description": "Basic authentication configuration for a Bicep registry." }, - "kubernetes": { + "azureWorkloadIdentity": { "type": { "$ref": "#/61" }, - "flags": 0 + "flags": 0, + "description": "Azure Workload Identity configuration for a Bicep registry." }, - "aws": { + "awsIrsa": { "type": { "$ref": "#/62" }, "flags": 0, - "description": "The AWS cloud provider definition." + "description": "AWS IRSA configuration for a Bicep registry." } } }, { "$type": "ObjectType", - "name": "ProvidersAzure", + "name": "BicepBasicAuthentication", "properties": { - "subscriptionId": { - "type": { - "$ref": "#/0" - }, - "flags": 1, - "description": "Azure subscription ID hosting deployed resources." - }, - "resourceGroupName": { + "username": { "type": { "$ref": "#/0" }, "flags": 0, - "description": "Optional resource group name." + "description": "Username for basic authentication." }, - "identity": { + "secret": { "type": { - "$ref": "#/16" + "$ref": "#/0" }, "flags": 0, - "description": "IdentitySettings is the external identity setting." + "description": "Resource ID of the Radius.Security/secrets entry containing the password." } } }, { "$type": "ObjectType", - "name": "ProvidersKubernetes", + "name": "BicepAzureWorkloadIdentityAuthentication", "properties": { - "namespace": { + "clientId": { "type": { "$ref": "#/0" }, - "flags": 1, - "description": "Kubernetes namespace to deploy workloads into." + "flags": 0, + "description": "Client ID used for Azure Workload Identity." + }, + "tenantId": { + "type": { + "$ref": "#/0" + }, + "flags": 0, + "description": "Tenant ID used for Azure Workload Identity." + }, + "secret": { + "type": { + "$ref": "#/0" + }, + "flags": 0, + "description": "Resource ID of the Radius.Security/secrets entry containing the workload identity token." } } }, { "$type": "ObjectType", - "name": "ProvidersAws", + "name": "BicepAwsIrsaAuthentication", "properties": { - "scope": { + "roleArn": { "type": { "$ref": "#/0" }, - "flags": 1, - "description": "Target scope for AWS resources to be deployed into. For example: '/planes/aws/aws/accounts/000000000000/regions/us-west-2'." + "flags": 0, + "description": "ARN of the AWS IAM role used for IRSA." + }, + "secret": { + "type": { + "$ref": "#/0" + }, + "flags": 0, + "description": "Resource ID of the Radius.Security/secrets entry containing the IRSA token." } } }, + { + "$type": "ObjectType", + "name": "BicepAuthenticationConfigurationRegistries", + "properties": {}, + "additionalProperties": { + "$ref": "#/59" + } + }, { "$type": "ObjectType", "name": "TrackedResourceTags", @@ -798,7 +815,7 @@ }, { "$type": "ResourceType", - "name": "Radius.Core/environments@2025-08-01-preview", + "name": "Radius.Core/bicepSettings@2025-08-01-preview", "body": { "$ref": "#/47" }, @@ -808,7 +825,7 @@ }, { "$type": "StringLiteralType", - "value": "Radius.Core/recipePacks" + "value": "Radius.Core/environments" }, { "$type": "StringLiteralType", @@ -816,7 +833,7 @@ }, { "$type": "ObjectType", - "name": "Radius.Core/recipePacks", + "name": "Radius.Core/environments", "properties": { "id": { "type": { @@ -834,28 +851,28 @@ }, "type": { "type": { - "$ref": "#/65" + "$ref": "#/66" }, "flags": 10, "description": "The resource type" }, "apiVersion": { "type": { - "$ref": "#/66" + "$ref": "#/67" }, "flags": 10, "description": "The resource api version" }, "properties": { "type": { - "$ref": "#/68" + "$ref": "#/69" }, "flags": 1, - "description": "Recipe Pack properties" + "description": "Environment properties" }, "tags": { "type": { - "$ref": "#/86" + "$ref": "#/84" }, "flags": 0, "description": "Resource tags." @@ -878,28 +895,48 @@ }, { "$type": "ObjectType", - "name": "RecipePackProperties", + "name": "EnvironmentProperties", "properties": { "provisioningState": { "type": { - "$ref": "#/77" + "$ref": "#/78" }, "flags": 2, "description": "Provisioning state of the resource at the time the operation was called" }, - "referencedBy": { + "terraformSettings": { "type": { - "$ref": "#/78" + "$ref": "#/0" }, - "flags": 2, - "description": "List of environment IDs that reference this recipe pack" + "flags": 0, + "description": "Resource ID of the Terraform settings applied to this environment." }, - "recipes": { + "bicepSettings": { + "type": { + "$ref": "#/0" + }, + "flags": 0, + "description": "Resource ID of the Bicep settings applied to this environment." + }, + "recipePacks": { "type": { - "$ref": "#/85" + "$ref": "#/79" }, - "flags": 1, - "description": "Map of resource types to their recipe configurations" + "flags": 0, + "description": "List of Recipe Pack resource IDs linked to this environment." + }, + "providers": { + "type": { + "$ref": "#/80" + }, + "flags": 0 + }, + "simulated": { + "type": { + "$ref": "#/30" + }, + "flags": 0, + "description": "Simulated environment." } } }, @@ -938,9 +975,6 @@ { "$type": "UnionType", "elements": [ - { - "$ref": "#/69" - }, { "$ref": "#/70" }, @@ -961,6 +995,9 @@ }, { "$ref": "#/76" + }, + { + "$ref": "#/77" } ] }, @@ -972,74 +1009,81 @@ }, { "$type": "ObjectType", - "name": "RecipeDefinition", + "name": "Providers", "properties": { - "recipeKind": { + "azure": { + "type": { + "$ref": "#/81" + }, + "flags": 0, + "description": "The Azure cloud provider definition." + }, + "kubernetes": { "type": { "$ref": "#/82" }, - "flags": 1, - "description": "The type of recipe" + "flags": 0 }, - "plainHttp": { + "aws": { "type": { - "$ref": "#/30" + "$ref": "#/83" }, "flags": 0, - "description": "Connect to the location using HTTP (not HTTPS). This should be used when the location is known not to support HTTPS, for example in a locally hosted registry for Bicep recipes. Defaults to false (use HTTPS/TLS)" - }, - "recipeLocation": { + "description": "The AWS cloud provider definition." + } + } + }, + { + "$type": "ObjectType", + "name": "ProvidersAzure", + "properties": { + "subscriptionId": { "type": { "$ref": "#/0" }, "flags": 1, - "description": "URL path to the recipe" + "description": "Azure subscription ID hosting deployed resources." }, - "parameters": { + "resourceGroupName": { "type": { - "$ref": "#/84" + "$ref": "#/0" }, "flags": 0, - "description": "Parameters to pass to the recipe" - } - } - }, - { - "$type": "StringLiteralType", - "value": "terraform" - }, - { - "$type": "StringLiteralType", - "value": "bicep" - }, - { - "$type": "UnionType", - "elements": [ - { - "$ref": "#/80" + "description": "Optional resource group name." }, - { - "$ref": "#/81" + "identity": { + "type": { + "$ref": "#/16" + }, + "flags": 0, + "description": "IdentitySettings is the external identity setting." } - ] - }, - { - "$type": "AnyType" + } }, { "$type": "ObjectType", - "name": "RecipeDefinitionParameters", - "properties": {}, - "additionalProperties": { - "$ref": "#/83" + "name": "ProvidersKubernetes", + "properties": { + "namespace": { + "type": { + "$ref": "#/0" + }, + "flags": 1, + "description": "Kubernetes namespace to deploy workloads into." + } } }, { "$type": "ObjectType", - "name": "RecipePackPropertiesRecipes", - "properties": {}, - "additionalProperties": { - "$ref": "#/79" + "name": "ProvidersAws", + "properties": { + "scope": { + "type": { + "$ref": "#/0" + }, + "flags": 1, + "description": "Target scope for AWS resources to be deployed into. For example: '/planes/aws/aws/accounts/000000000000/regions/us-west-2'." + } } }, { @@ -1052,9 +1096,691 @@ }, { "$type": "ResourceType", - "name": "Radius.Core/recipePacks@2025-08-01-preview", + "name": "Radius.Core/environments@2025-08-01-preview", + "body": { + "$ref": "#/68" + }, + "readableScopes": 0, + "writableScopes": 0, + "functions": {} + }, + { + "$type": "StringLiteralType", + "value": "Radius.Core/recipePacks" + }, + { + "$type": "StringLiteralType", + "value": "2025-08-01-preview" + }, + { + "$type": "ObjectType", + "name": "Radius.Core/recipePacks", + "properties": { + "id": { + "type": { + "$ref": "#/0" + }, + "flags": 10, + "description": "The resource id" + }, + "name": { + "type": { + "$ref": "#/0" + }, + "flags": 25, + "description": "The resource name" + }, + "type": { + "type": { + "$ref": "#/86" + }, + "flags": 10, + "description": "The resource type" + }, + "apiVersion": { + "type": { + "$ref": "#/87" + }, + "flags": 10, + "description": "The resource api version" + }, + "properties": { + "type": { + "$ref": "#/89" + }, + "flags": 1, + "description": "Recipe Pack properties" + }, + "tags": { + "type": { + "$ref": "#/107" + }, + "flags": 0, + "description": "Resource tags." + }, + "location": { + "type": { + "$ref": "#/0" + }, + "flags": 0, + "description": "The geo-location where the resource lives" + }, + "systemData": { + "type": { + "$ref": "#/33" + }, + "flags": 2, + "description": "Metadata pertaining to creation and last modification of the resource." + } + } + }, + { + "$type": "ObjectType", + "name": "RecipePackProperties", + "properties": { + "provisioningState": { + "type": { + "$ref": "#/98" + }, + "flags": 2, + "description": "Provisioning state of the resource at the time the operation was called" + }, + "referencedBy": { + "type": { + "$ref": "#/99" + }, + "flags": 2, + "description": "List of environment IDs that reference this recipe pack" + }, + "recipes": { + "type": { + "$ref": "#/106" + }, + "flags": 1, + "description": "Map of resource types to their recipe configurations" + } + } + }, + { + "$type": "StringLiteralType", + "value": "Creating" + }, + { + "$type": "StringLiteralType", + "value": "Updating" + }, + { + "$type": "StringLiteralType", + "value": "Deleting" + }, + { + "$type": "StringLiteralType", + "value": "Accepted" + }, + { + "$type": "StringLiteralType", + "value": "Provisioning" + }, + { + "$type": "StringLiteralType", + "value": "Succeeded" + }, + { + "$type": "StringLiteralType", + "value": "Failed" + }, + { + "$type": "StringLiteralType", + "value": "Canceled" + }, + { + "$type": "UnionType", + "elements": [ + { + "$ref": "#/90" + }, + { + "$ref": "#/91" + }, + { + "$ref": "#/92" + }, + { + "$ref": "#/93" + }, + { + "$ref": "#/94" + }, + { + "$ref": "#/95" + }, + { + "$ref": "#/96" + }, + { + "$ref": "#/97" + } + ] + }, + { + "$type": "ArrayType", + "itemType": { + "$ref": "#/0" + } + }, + { + "$type": "ObjectType", + "name": "RecipeDefinition", + "properties": { + "recipeKind": { + "type": { + "$ref": "#/103" + }, + "flags": 1, + "description": "The type of recipe" + }, + "plainHttp": { + "type": { + "$ref": "#/30" + }, + "flags": 0, + "description": "Connect to the location using HTTP (not HTTPS). This should be used when the location is known not to support HTTPS, for example in a locally hosted registry for Bicep recipes. Defaults to false (use HTTPS/TLS)" + }, + "recipeLocation": { + "type": { + "$ref": "#/0" + }, + "flags": 1, + "description": "URL path to the recipe" + }, + "parameters": { + "type": { + "$ref": "#/105" + }, + "flags": 0, + "description": "Parameters to pass to the recipe" + } + } + }, + { + "$type": "StringLiteralType", + "value": "terraform" + }, + { + "$type": "StringLiteralType", + "value": "bicep" + }, + { + "$type": "UnionType", + "elements": [ + { + "$ref": "#/101" + }, + { + "$ref": "#/102" + } + ] + }, + { + "$type": "AnyType" + }, + { + "$type": "ObjectType", + "name": "RecipeDefinitionParameters", + "properties": {}, + "additionalProperties": { + "$ref": "#/104" + } + }, + { + "$type": "ObjectType", + "name": "RecipePackPropertiesRecipes", + "properties": {}, + "additionalProperties": { + "$ref": "#/100" + } + }, + { + "$type": "ObjectType", + "name": "TrackedResourceTags", + "properties": {}, + "additionalProperties": { + "$ref": "#/0" + } + }, + { + "$type": "ResourceType", + "name": "Radius.Core/recipePacks@2025-08-01-preview", + "body": { + "$ref": "#/88" + }, + "readableScopes": 0, + "writableScopes": 0, + "functions": {} + }, + { + "$type": "StringLiteralType", + "value": "Radius.Core/terraformSettings" + }, + { + "$type": "StringLiteralType", + "value": "2025-08-01-preview" + }, + { + "$type": "ObjectType", + "name": "Radius.Core/terraformSettings", + "properties": { + "id": { + "type": { + "$ref": "#/0" + }, + "flags": 10, + "description": "The resource id" + }, + "name": { + "type": { + "$ref": "#/0" + }, + "flags": 25, + "description": "The resource name" + }, + "type": { + "type": { + "$ref": "#/109" + }, + "flags": 10, + "description": "The resource type" + }, + "apiVersion": { + "type": { + "$ref": "#/110" + }, + "flags": 10, + "description": "The resource api version" + }, + "properties": { + "type": { + "$ref": "#/112" + }, + "flags": 1, + "description": "Terraform settings properties." + }, + "tags": { + "type": { + "$ref": "#/143" + }, + "flags": 0, + "description": "Resource tags." + }, + "location": { + "type": { + "$ref": "#/0" + }, + "flags": 0, + "description": "The geo-location where the resource lives" + }, + "systemData": { + "type": { + "$ref": "#/33" + }, + "flags": 2, + "description": "Metadata pertaining to creation and last modification of the resource." + } + } + }, + { + "$type": "ObjectType", + "name": "TerraformSettingsProperties", + "properties": { + "provisioningState": { + "type": { + "$ref": "#/121" + }, + "flags": 2, + "description": "Provisioning state of the resource at the time the operation was called" + }, + "terraformrc": { + "type": { + "$ref": "#/122" + }, + "flags": 0, + "description": "Terraform CLI configuration matching the terraformrc file." + }, + "backend": { + "type": { + "$ref": "#/132" + }, + "flags": 0, + "description": "Terraform backend configuration matching the terraform block." + }, + "env": { + "type": { + "$ref": "#/134" + }, + "flags": 0, + "description": "Environment variables injected into the Terraform process." + }, + "logging": { + "type": { + "$ref": "#/135" + }, + "flags": 0, + "description": "Logging options for Terraform executions." + } + } + }, + { + "$type": "StringLiteralType", + "value": "Creating" + }, + { + "$type": "StringLiteralType", + "value": "Updating" + }, + { + "$type": "StringLiteralType", + "value": "Deleting" + }, + { + "$type": "StringLiteralType", + "value": "Accepted" + }, + { + "$type": "StringLiteralType", + "value": "Provisioning" + }, + { + "$type": "StringLiteralType", + "value": "Succeeded" + }, + { + "$type": "StringLiteralType", + "value": "Failed" + }, + { + "$type": "StringLiteralType", + "value": "Canceled" + }, + { + "$type": "UnionType", + "elements": [ + { + "$ref": "#/113" + }, + { + "$ref": "#/114" + }, + { + "$ref": "#/115" + }, + { + "$ref": "#/116" + }, + { + "$ref": "#/117" + }, + { + "$ref": "#/118" + }, + { + "$ref": "#/119" + }, + { + "$ref": "#/120" + } + ] + }, + { + "$type": "ObjectType", + "name": "TerraformCliConfiguration", + "properties": { + "provider_installation": { + "type": { + "$ref": "#/123" + }, + "flags": 0, + "description": "Provider installation options for Terraform." + }, + "credentials": { + "type": { + "$ref": "#/131" + }, + "flags": 0, + "description": "Credentials keyed by registry or module source hostname." + } + } + }, + { + "$type": "ObjectType", + "name": "TerraformProviderInstallationConfiguration", + "properties": { + "network_mirror": { + "type": { + "$ref": "#/124" + }, + "flags": 0, + "description": "Network mirror configuration for Terraform providers." + }, + "direct": { + "type": { + "$ref": "#/127" + }, + "flags": 0, + "description": "Direct installation configuration for Terraform providers." + } + } + }, + { + "$type": "ObjectType", + "name": "TerraformNetworkMirrorConfiguration", + "properties": { + "url": { + "type": { + "$ref": "#/0" + }, + "flags": 1, + "description": "Mirror URL used to download providers." + }, + "include": { + "type": { + "$ref": "#/125" + }, + "flags": 0, + "description": "Provider addresses included in this mirror." + }, + "exclude": { + "type": { + "$ref": "#/126" + }, + "flags": 0, + "description": "Provider addresses excluded from this mirror." + } + } + }, + { + "$type": "ArrayType", + "itemType": { + "$ref": "#/0" + } + }, + { + "$type": "ArrayType", + "itemType": { + "$ref": "#/0" + } + }, + { + "$type": "ObjectType", + "name": "TerraformDirectConfiguration", + "properties": { + "include": { + "type": { + "$ref": "#/128" + }, + "flags": 0, + "description": "Provider addresses included when falling back to direct installation." + }, + "exclude": { + "type": { + "$ref": "#/129" + }, + "flags": 0, + "description": "Provider addresses excluded from direct installation." + } + } + }, + { + "$type": "ArrayType", + "itemType": { + "$ref": "#/0" + } + }, + { + "$type": "ArrayType", + "itemType": { + "$ref": "#/0" + } + }, + { + "$type": "ObjectType", + "name": "TerraformCredentialConfiguration", + "properties": { + "secret": { + "type": { + "$ref": "#/0" + }, + "flags": 0, + "description": "Resource ID of the Radius.Security/secrets entry containing the credential values (for example token)." + } + } + }, + { + "$type": "ObjectType", + "name": "TerraformCliConfigurationCredentials", + "properties": {}, + "additionalProperties": { + "$ref": "#/130" + } + }, + { + "$type": "ObjectType", + "name": "TerraformBackendConfiguration", + "properties": { + "type": { + "type": { + "$ref": "#/0" + }, + "flags": 1, + "description": "Backend type (for example 'kubernetes')." + }, + "config": { + "type": { + "$ref": "#/133" + }, + "flags": 0, + "description": "Backend-specific configuration values." + } + }, + "additionalProperties": { + "$ref": "#/104" + } + }, + { + "$type": "ObjectType", + "name": "TerraformBackendConfigurationConfig", + "properties": {}, + "additionalProperties": { + "$ref": "#/104" + } + }, + { + "$type": "ObjectType", + "name": "TerraformSettingsPropertiesEnv", + "properties": {}, + "additionalProperties": { + "$ref": "#/0" + } + }, + { + "$type": "ObjectType", + "name": "TerraformLoggingConfiguration", + "properties": { + "level": { + "type": { + "$ref": "#/142" + }, + "flags": 0, + "description": "Terraform log verbosity levels." + }, + "path": { + "type": { + "$ref": "#/0" + }, + "flags": 0, + "description": "Destination file path for Terraform logs (maps to TF_LOG_PATH)." + } + } + }, + { + "$type": "StringLiteralType", + "value": "TRACE" + }, + { + "$type": "StringLiteralType", + "value": "DEBUG" + }, + { + "$type": "StringLiteralType", + "value": "INFO" + }, + { + "$type": "StringLiteralType", + "value": "WARN" + }, + { + "$type": "StringLiteralType", + "value": "ERROR" + }, + { + "$type": "StringLiteralType", + "value": "FATAL" + }, + { + "$type": "UnionType", + "elements": [ + { + "$ref": "#/136" + }, + { + "$ref": "#/137" + }, + { + "$ref": "#/138" + }, + { + "$ref": "#/139" + }, + { + "$ref": "#/140" + }, + { + "$ref": "#/141" + } + ] + }, + { + "$type": "ObjectType", + "name": "TrackedResourceTags", + "properties": {}, + "additionalProperties": { + "$ref": "#/0" + } + }, + { + "$type": "ResourceType", + "name": "Radius.Core/terraformSettings@2025-08-01-preview", "body": { - "$ref": "#/67" + "$ref": "#/111" }, "readableScopes": 0, "writableScopes": 0, diff --git a/pkg/corerp/api/v20250801preview/environment_conversion.go b/pkg/corerp/api/v20250801preview/environment_conversion.go index 2fd54f2fe7..9094026348 100644 --- a/pkg/corerp/api/v20250801preview/environment_conversion.go +++ b/pkg/corerp/api/v20250801preview/environment_conversion.go @@ -59,6 +59,16 @@ func (src *EnvironmentResource) ConvertTo() (v1.DataModelInterface, error) { converted.Properties.Simulated = true } + // Convert TerraformSettings + if src.Properties.TerraformSettings != nil { + converted.Properties.TerraformSettings = to.String(src.Properties.TerraformSettings) + } + + // Convert BicepSettings + if src.Properties.BicepSettings != nil { + converted.Properties.BicepSettings = to.String(src.Properties.BicepSettings) + } + return converted, nil } @@ -94,6 +104,16 @@ func (dst *EnvironmentResource) ConvertFrom(src v1.DataModelInterface) error { dst.Properties.Simulated = to.Ptr(env.Properties.Simulated) } + // Convert TerraformSettings + if env.Properties.TerraformSettings != "" { + dst.Properties.TerraformSettings = to.Ptr(env.Properties.TerraformSettings) + } + + // Convert BicepSettings + if env.Properties.BicepSettings != "" { + dst.Properties.BicepSettings = to.Ptr(env.Properties.BicepSettings) + } + return nil } diff --git a/pkg/corerp/api/v20250801preview/environment_conversion_test.go b/pkg/corerp/api/v20250801preview/environment_conversion_test.go index 84ae58cac2..55e1734253 100644 --- a/pkg/corerp/api/v20250801preview/environment_conversion_test.go +++ b/pkg/corerp/api/v20250801preview/environment_conversion_test.go @@ -39,6 +39,8 @@ func TestEnvironmentConvertVersionedToDataModel(t *testing.T) { RecipePacks: []*string{ to.Ptr("/planes/radius/local/providers/Radius.Core/recipePacks/azure-aci-pack"), }, + TerraformSettings: to.Ptr("/planes/radius/local/providers/Radius.Core/terraformSettings/org-default"), + BicepSettings: to.Ptr("/planes/radius/local/providers/Radius.Core/bicepSettings/org-default"), Providers: &Providers{ Azure: &ProvidersAzure{ SubscriptionID: to.Ptr("00000000-0000-0000-0000-000000000000"), @@ -66,6 +68,8 @@ func TestEnvironmentConvertVersionedToDataModel(t *testing.T) { require.Equal(t, map[string]string{"env": "test"}, env.Tags) require.Equal(t, []string{"/planes/radius/local/providers/Radius.Core/recipePacks/azure-aci-pack"}, env.Properties.RecipePacks) require.Equal(t, false, env.Properties.Simulated) + require.Equal(t, "/planes/radius/local/providers/Radius.Core/terraformSettings/org-default", env.Properties.TerraformSettings) + require.Equal(t, "/planes/radius/local/providers/Radius.Core/bicepSettings/org-default", env.Properties.BicepSettings) require.NotNil(t, env.Properties.Providers) require.NotNil(t, env.Properties.Providers.Azure) require.Equal(t, "00000000-0000-0000-0000-000000000000", env.Properties.Providers.Azure.SubscriptionId) @@ -91,7 +95,9 @@ func TestEnvironmentConvertDataModelToVersioned(t *testing.T) { }, }, Properties: datamodel.EnvironmentProperties_v20250801preview{ - RecipePacks: []string{"/planes/radius/local/providers/Radius.Core/recipePacks/test-pack"}, + RecipePacks: []string{"/planes/radius/local/providers/Radius.Core/recipePacks/test-pack"}, + TerraformSettings: "/planes/radius/local/providers/Radius.Core/terraformSettings/org-default", + BicepSettings: "/planes/radius/local/providers/Radius.Core/bicepSettings/org-default", Providers: &datamodel.Providers_v20250801preview{ Kubernetes: &datamodel.ProvidersKubernetes_v20250801preview{ Namespace: "default", @@ -113,4 +119,6 @@ func TestEnvironmentConvertDataModelToVersioned(t *testing.T) { require.NotNil(t, versionedResource.Properties.Providers) require.NotNil(t, versionedResource.Properties.Providers.Kubernetes) require.Equal(t, to.Ptr("default"), versionedResource.Properties.Providers.Kubernetes.Namespace) + require.Equal(t, to.Ptr("/planes/radius/local/providers/Radius.Core/terraformSettings/org-default"), versionedResource.Properties.TerraformSettings) + require.Equal(t, to.Ptr("/planes/radius/local/providers/Radius.Core/bicepSettings/org-default"), versionedResource.Properties.BicepSettings) } diff --git a/pkg/corerp/api/v20250801preview/zz_generated_bicepsettings_client.go b/pkg/corerp/api/v20250801preview/zz_generated_bicepsettings_client.go new file mode 100644 index 0000000000..dfca5a9418 --- /dev/null +++ b/pkg/corerp/api/v20250801preview/zz_generated_bicepsettings_client.go @@ -0,0 +1,308 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package v20250801preview + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// BicepSettingsClient contains the methods for the BicepSettings group. +// Don't use this type directly, use NewBicepSettingsClient() instead. +type BicepSettingsClient struct { + internal *arm.Client + rootScope string +} + +// NewBicepSettingsClient creates a new instance of BicepSettingsClient with the specified values. +// - rootScope - The scope in which the resource is present. UCP Scope is /planes/{planeType}/{planeName}/resourceGroup/{resourcegroupID} +// and Azure resource scope is +// /subscriptions/{subscriptionID}/resourceGroup/{resourcegroupID} +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewBicepSettingsClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*BicepSettingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &BicepSettingsClient{ + rootScope: rootScope, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a BicepSettingsResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-08-01-preview +// - bicepSettingsName - Bicep settings resource name. +// - resource - Resource create parameters. +// - options - BicepSettingsClientCreateOrUpdateOptions contains the optional parameters for the BicepSettingsClient.CreateOrUpdate +// method. +func (client *BicepSettingsClient) CreateOrUpdate(ctx context.Context, bicepSettingsName string, resource BicepSettingsResource, options *BicepSettingsClientCreateOrUpdateOptions) (BicepSettingsClientCreateOrUpdateResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "BicepSettingsClient.CreateOrUpdate", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, bicepSettingsName, resource, options) + if err != nil { + return BicepSettingsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BicepSettingsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return BicepSettingsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *BicepSettingsClient) createOrUpdateCreateRequest(ctx context.Context, bicepSettingsName string, resource BicepSettingsResource, _ *BicepSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{rootScope}/providers/Radius.Core/bicepSettings/{bicepSettingsName}" + urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) + if bicepSettingsName == "" { + return nil, errors.New("parameter bicepSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bicepSettingsName}", url.PathEscape(bicepSettingsName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *BicepSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (BicepSettingsClientCreateOrUpdateResponse, error) { + result := BicepSettingsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BicepSettingsResource); err != nil { + return BicepSettingsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a BicepSettingsResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-08-01-preview +// - bicepSettingsName - Bicep settings resource name. +// - options - BicepSettingsClientDeleteOptions contains the optional parameters for the BicepSettingsClient.Delete method. +func (client *BicepSettingsClient) Delete(ctx context.Context, bicepSettingsName string, options *BicepSettingsClientDeleteOptions) (BicepSettingsClientDeleteResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "BicepSettingsClient.Delete", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, bicepSettingsName, options) + if err != nil { + return BicepSettingsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BicepSettingsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return BicepSettingsClientDeleteResponse{}, err + } + return BicepSettingsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *BicepSettingsClient) deleteCreateRequest(ctx context.Context, bicepSettingsName string, _ *BicepSettingsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{rootScope}/providers/Radius.Core/bicepSettings/{bicepSettingsName}" + urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) + if bicepSettingsName == "" { + return nil, errors.New("parameter bicepSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bicepSettingsName}", url.PathEscape(bicepSettingsName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a BicepSettingsResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-08-01-preview +// - bicepSettingsName - Bicep settings resource name. +// - options - BicepSettingsClientGetOptions contains the optional parameters for the BicepSettingsClient.Get method. +func (client *BicepSettingsClient) Get(ctx context.Context, bicepSettingsName string, options *BicepSettingsClientGetOptions) (BicepSettingsClientGetResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "BicepSettingsClient.Get", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, bicepSettingsName, options) + if err != nil { + return BicepSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BicepSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BicepSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *BicepSettingsClient) getCreateRequest(ctx context.Context, bicepSettingsName string, _ *BicepSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/{rootScope}/providers/Radius.Core/bicepSettings/{bicepSettingsName}" + urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) + if bicepSettingsName == "" { + return nil, errors.New("parameter bicepSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bicepSettingsName}", url.PathEscape(bicepSettingsName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *BicepSettingsClient) getHandleResponse(resp *http.Response) (BicepSettingsClientGetResponse, error) { + result := BicepSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BicepSettingsResource); err != nil { + return BicepSettingsClientGetResponse{}, err + } + return result, nil +} + +// NewListByScopePager - List BicepSettingsResource resources by Scope +// +// Generated from API version 2025-08-01-preview +// - options - BicepSettingsClientListByScopeOptions contains the optional parameters for the BicepSettingsClient.NewListByScopePager +// method. +func (client *BicepSettingsClient) NewListByScopePager(options *BicepSettingsClientListByScopeOptions) *runtime.Pager[BicepSettingsClientListByScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[BicepSettingsClientListByScopeResponse]{ + More: func(page BicepSettingsClientListByScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *BicepSettingsClientListByScopeResponse) (BicepSettingsClientListByScopeResponse, error) { + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) + if err != nil { + return BicepSettingsClientListByScopeResponse{}, err + } + return client.listByScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByScopeCreateRequest creates the ListByScope request. +func (client *BicepSettingsClient) listByScopeCreateRequest(ctx context.Context, _ *BicepSettingsClientListByScopeOptions) (*policy.Request, error) { + urlPath := "/{rootScope}/providers/Radius.Core/bicepSettings" + urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByScopeHandleResponse handles the ListByScope response. +func (client *BicepSettingsClient) listByScopeHandleResponse(resp *http.Response) (BicepSettingsClientListByScopeResponse, error) { + result := BicepSettingsClientListByScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BicepSettingsResourceListResult); err != nil { + return BicepSettingsClientListByScopeResponse{}, err + } + return result, nil +} + +// Update - Update a BicepSettingsResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-08-01-preview +// - bicepSettingsName - Bicep settings resource name. +// - properties - The resource properties to be updated. +// - options - BicepSettingsClientUpdateOptions contains the optional parameters for the BicepSettingsClient.Update method. +func (client *BicepSettingsClient) Update(ctx context.Context, bicepSettingsName string, properties BicepSettingsResourceUpdate, options *BicepSettingsClientUpdateOptions) (BicepSettingsClientUpdateResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "BicepSettingsClient.Update", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, bicepSettingsName, properties, options) + if err != nil { + return BicepSettingsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return BicepSettingsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return BicepSettingsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *BicepSettingsClient) updateCreateRequest(ctx context.Context, bicepSettingsName string, properties BicepSettingsResourceUpdate, _ *BicepSettingsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/{rootScope}/providers/Radius.Core/bicepSettings/{bicepSettingsName}" + urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) + if bicepSettingsName == "" { + return nil, errors.New("parameter bicepSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{bicepSettingsName}", url.PathEscape(bicepSettingsName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *BicepSettingsClient) updateHandleResponse(resp *http.Response) (BicepSettingsClientUpdateResponse, error) { + result := BicepSettingsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.BicepSettingsResource); err != nil { + return BicepSettingsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/pkg/corerp/api/v20250801preview/zz_generated_client_factory.go b/pkg/corerp/api/v20250801preview/zz_generated_client_factory.go index 34359ee937..e3236d9f2b 100644 --- a/pkg/corerp/api/v20250801preview/zz_generated_client_factory.go +++ b/pkg/corerp/api/v20250801preview/zz_generated_client_factory.go @@ -42,6 +42,14 @@ func (c *ClientFactory) NewApplicationsClient() *ApplicationsClient { } } +// NewBicepSettingsClient creates a new instance of BicepSettingsClient. +func (c *ClientFactory) NewBicepSettingsClient() *BicepSettingsClient { + return &BicepSettingsClient{ + rootScope: c.rootScope, + internal: c.internal, + } +} + // NewEnvironmentsClient creates a new instance of EnvironmentsClient. func (c *ClientFactory) NewEnvironmentsClient() *EnvironmentsClient { return &EnvironmentsClient{ @@ -64,3 +72,11 @@ func (c *ClientFactory) NewRecipePacksClient() *RecipePacksClient { internal: c.internal, } } + +// NewTerraformSettingsClient creates a new instance of TerraformSettingsClient. +func (c *ClientFactory) NewTerraformSettingsClient() *TerraformSettingsClient { + return &TerraformSettingsClient{ + rootScope: c.rootScope, + internal: c.internal, + } +} diff --git a/pkg/corerp/api/v20250801preview/zz_generated_constants.go b/pkg/corerp/api/v20250801preview/zz_generated_constants.go index 613cf45fe8..9b4c0f15fe 100644 --- a/pkg/corerp/api/v20250801preview/zz_generated_constants.go +++ b/pkg/corerp/api/v20250801preview/zz_generated_constants.go @@ -156,3 +156,27 @@ func PossibleRecipeKindValues() []RecipeKind { RecipeKindTerraform, } } + +// TerraformLogLevel - Terraform log verbosity levels. +type TerraformLogLevel string + +const ( + TerraformLogLevelDebug TerraformLogLevel = "DEBUG" + TerraformLogLevelError TerraformLogLevel = "ERROR" + TerraformLogLevelFatal TerraformLogLevel = "FATAL" + TerraformLogLevelInfo TerraformLogLevel = "INFO" + TerraformLogLevelTrace TerraformLogLevel = "TRACE" + TerraformLogLevelWarn TerraformLogLevel = "WARN" +) + +// PossibleTerraformLogLevelValues returns the possible values for the TerraformLogLevel const type. +func PossibleTerraformLogLevelValues() []TerraformLogLevel { + return []TerraformLogLevel{ + TerraformLogLevelDebug, + TerraformLogLevelError, + TerraformLogLevelFatal, + TerraformLogLevelInfo, + TerraformLogLevelTrace, + TerraformLogLevelWarn, + } +} diff --git a/pkg/corerp/api/v20250801preview/zz_generated_models.go b/pkg/corerp/api/v20250801preview/zz_generated_models.go index 58970ba9aa..0d404cbaa7 100644 --- a/pkg/corerp/api/v20250801preview/zz_generated_models.go +++ b/pkg/corerp/api/v20250801preview/zz_generated_models.go @@ -161,6 +161,114 @@ type AzureResourceManagerCommonTypesTrackedResourceUpdate struct { Type *string } +// BicepAuthenticationConfiguration - Authentication configuration for Bicep registries. +type BicepAuthenticationConfiguration struct { + // Authentication entries keyed by registry hostname. + Registries map[string]*BicepRegistryAuthentication +} + +// BicepAwsIrsaAuthentication - AWS IRSA configuration for a Bicep registry. +type BicepAwsIrsaAuthentication struct { + // ARN of the AWS IAM role used for IRSA. + RoleArn *string + + // Resource ID of the Radius.Security/secrets entry containing the IRSA token. + Secret *string +} + +// BicepAzureWorkloadIdentityAuthentication - Azure Workload Identity configuration for a Bicep registry. +type BicepAzureWorkloadIdentityAuthentication struct { + // Client ID used for Azure Workload Identity. + ClientID *string + + // Resource ID of the Radius.Security/secrets entry containing the workload identity token. + Secret *string + + // Tenant ID used for Azure Workload Identity. + TenantID *string +} + +// BicepBasicAuthentication - Basic authentication configuration for a Bicep registry. +type BicepBasicAuthentication struct { + // Resource ID of the Radius.Security/secrets entry containing the password. + Secret *string + + // Username for basic authentication. + Username *string +} + +// BicepRegistryAuthentication - Registry authentication options for a private Bicep registry. +type BicepRegistryAuthentication struct { + // AWS IRSA authentication settings for a registry. + AwsIrsa *BicepAwsIrsaAuthentication + + // Azure Workload Identity authentication settings for a registry. + AzureWorkloadIdentity *BicepAzureWorkloadIdentityAuthentication + + // Basic authentication settings for a registry. + Basic *BicepBasicAuthentication +} + +// BicepSettingsProperties - Bicep settings properties. +type BicepSettingsProperties struct { + // Authentication settings for private registries. + Authentication *BicepAuthenticationConfiguration + + // READ-ONLY; Provisioning state of the asynchronous operation. + ProvisioningState *ProvisioningState +} + +// BicepSettingsResource - Bicep settings resource. +type BicepSettingsResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; The resource-specific properties for this resource. + Properties *BicepSettingsProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// BicepSettingsResourceListResult - The response of a BicepSettingsResource list operation. +type BicepSettingsResourceListResult struct { + // REQUIRED; The BicepSettingsResource items on this page + Value []*BicepSettingsResource + + // The link to the next page of items + NextLink *string +} + +// BicepSettingsResourceUpdate - Bicep settings resource. +type BicepSettingsResourceUpdate struct { + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + // EnvironmentCompute - Represents backing compute resource type EnvironmentCompute struct { // REQUIRED; Discriminator property for EnvironmentCompute. @@ -178,6 +286,9 @@ func (e *EnvironmentCompute) GetEnvironmentCompute() *EnvironmentCompute { retur // EnvironmentProperties - Environment properties type EnvironmentProperties struct { + // Resource ID of the Bicep settings applied to this environment. + BicepSettings *string + // Cloud provider configuration for the environment. Providers *Providers @@ -187,6 +298,9 @@ type EnvironmentProperties struct { // Simulated environment. Simulated *bool + // Resource ID of the Terraform settings applied to this environment. + TerraformSettings *string + // READ-ONLY; The status of the asynchronous operation. ProvisioningState *ProvisioningState } @@ -552,6 +666,141 @@ type SystemData struct { LastModifiedByType *CreatedByType } +// TerraformBackendConfiguration - Terraform backend configuration matching the terraform block. +type TerraformBackendConfiguration struct { + // REQUIRED; Backend type (for example 'kubernetes'). + Type *string + + // OPTIONAL; Contains additional key/value pairs not defined in the schema. + AdditionalProperties map[string]any + + // Backend-specific configuration values. + Config map[string]any +} + +// TerraformCliConfiguration - Terraform CLI configuration matching the terraformrc file. +type TerraformCliConfiguration struct { + // Credentials keyed by registry or module source hostname. + Credentials map[string]*TerraformCredentialConfiguration + + // Provider installation configuration controlling how Terraform installs providers. + ProviderInstallation *TerraformProviderInstallationConfiguration +} + +// TerraformCredentialConfiguration - Credential configuration for Terraform provider or module sources. +type TerraformCredentialConfiguration struct { + // Resource ID of the Radius.Security/secrets entry containing the credential values (for example token). + Secret *string +} + +// TerraformDirectConfiguration - Direct installation configuration for Terraform providers. +type TerraformDirectConfiguration struct { + // Provider addresses excluded from direct installation. + Exclude []*string + + // Provider addresses included when falling back to direct installation. + Include []*string +} + +// TerraformLoggingConfiguration - Logging options for Terraform executions. +type TerraformLoggingConfiguration struct { + // Terraform log verbosity (maps to TF_LOG). + Level *TerraformLogLevel + + // Destination file path for Terraform logs (maps to TFLOGPATH). + Path *string +} + +// TerraformNetworkMirrorConfiguration - Network mirror configuration for Terraform providers. +type TerraformNetworkMirrorConfiguration struct { + // REQUIRED; Mirror URL used to download providers. + URL *string + + // Provider addresses excluded from this mirror. + Exclude []*string + + // Provider addresses included in this mirror. + Include []*string +} + +// TerraformProviderInstallationConfiguration - Provider installation options for Terraform. +type TerraformProviderInstallationConfiguration struct { + // Direct installation rules controlling when Terraform reaches public registries. + Direct *TerraformDirectConfiguration + + // Network mirror configuration used to download providers. + NetworkMirror *TerraformNetworkMirrorConfiguration +} + +// TerraformSettingsProperties - Terraform settings properties. +type TerraformSettingsProperties struct { + // Terraform backend configuration. + Backend *TerraformBackendConfiguration + + // Environment variables injected into the Terraform process. + Env map[string]*string + + // Logging configuration applied to Terraform executions. + Logging *TerraformLoggingConfiguration + + // Terraform CLI configuration equivalent to the terraformrc file. + Terraformrc *TerraformCliConfiguration + + // READ-ONLY; Provisioning state of the asynchronous operation. + ProvisioningState *ProvisioningState +} + +// TerraformSettingsResource - Terraform settings resource. +type TerraformSettingsResource struct { + // REQUIRED; The geo-location where the resource lives + Location *string + + // REQUIRED; The resource-specific properties for this resource. + Properties *TerraformSettingsProperties + + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + +// TerraformSettingsResourceListResult - The response of a TerraformSettingsResource list operation. +type TerraformSettingsResourceListResult struct { + // REQUIRED; The TerraformSettingsResource items on this page + Value []*TerraformSettingsResource + + // The link to the next page of items + NextLink *string +} + +// TerraformSettingsResourceUpdate - Terraform settings resource. +type TerraformSettingsResourceUpdate struct { + // Resource tags. + Tags map[string]*string + + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string + + // READ-ONLY; The name of the resource + Name *string + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData + + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" + Type *string +} + // TrackedResource - The resource model definition for an Azure Resource Manager tracked top level resource which has 'tags' // and a 'location' type TrackedResource struct { diff --git a/pkg/corerp/api/v20250801preview/zz_generated_models_serde.go b/pkg/corerp/api/v20250801preview/zz_generated_models_serde.go index dbeb6cfe38..1b20b3b230 100644 --- a/pkg/corerp/api/v20250801preview/zz_generated_models_serde.go +++ b/pkg/corerp/api/v20250801preview/zz_generated_models_serde.go @@ -393,6 +393,321 @@ func (a *AzureResourceManagerCommonTypesTrackedResourceUpdate) UnmarshalJSON(dat return nil } +// MarshalJSON implements the json.Marshaller interface for type BicepAuthenticationConfiguration. +func (b BicepAuthenticationConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "registries", b.Registries) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BicepAuthenticationConfiguration. +func (b *BicepAuthenticationConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "registries": + err = unpopulate(val, "Registries", &b.Registries) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BicepAwsIrsaAuthentication. +func (b BicepAwsIrsaAuthentication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "roleArn", b.RoleArn) + populate(objectMap, "secret", b.Secret) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BicepAwsIrsaAuthentication. +func (b *BicepAwsIrsaAuthentication) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "roleArn": + err = unpopulate(val, "RoleArn", &b.RoleArn) + delete(rawMsg, key) + case "secret": + err = unpopulate(val, "Secret", &b.Secret) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BicepAzureWorkloadIdentityAuthentication. +func (b BicepAzureWorkloadIdentityAuthentication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "clientId", b.ClientID) + populate(objectMap, "secret", b.Secret) + populate(objectMap, "tenantId", b.TenantID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BicepAzureWorkloadIdentityAuthentication. +func (b *BicepAzureWorkloadIdentityAuthentication) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "clientId": + err = unpopulate(val, "ClientID", &b.ClientID) + delete(rawMsg, key) + case "secret": + err = unpopulate(val, "Secret", &b.Secret) + delete(rawMsg, key) + case "tenantId": + err = unpopulate(val, "TenantID", &b.TenantID) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BicepBasicAuthentication. +func (b BicepBasicAuthentication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "secret", b.Secret) + populate(objectMap, "username", b.Username) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BicepBasicAuthentication. +func (b *BicepBasicAuthentication) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secret": + err = unpopulate(val, "Secret", &b.Secret) + delete(rawMsg, key) + case "username": + err = unpopulate(val, "Username", &b.Username) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BicepRegistryAuthentication. +func (b BicepRegistryAuthentication) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "awsIrsa", b.AwsIrsa) + populate(objectMap, "azureWorkloadIdentity", b.AzureWorkloadIdentity) + populate(objectMap, "basic", b.Basic) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BicepRegistryAuthentication. +func (b *BicepRegistryAuthentication) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "awsIrsa": + err = unpopulate(val, "AwsIrsa", &b.AwsIrsa) + delete(rawMsg, key) + case "azureWorkloadIdentity": + err = unpopulate(val, "AzureWorkloadIdentity", &b.AzureWorkloadIdentity) + delete(rawMsg, key) + case "basic": + err = unpopulate(val, "Basic", &b.Basic) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BicepSettingsProperties. +func (b BicepSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "authentication", b.Authentication) + populate(objectMap, "provisioningState", b.ProvisioningState) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BicepSettingsProperties. +func (b *BicepSettingsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "authentication": + err = unpopulate(val, "Authentication", &b.Authentication) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &b.ProvisioningState) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BicepSettingsResource. +func (b BicepSettingsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "location", b.Location) + populate(objectMap, "name", b.Name) + populate(objectMap, "properties", b.Properties) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BicepSettingsResource. +func (b *BicepSettingsResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &b.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &b.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &b.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BicepSettingsResourceListResult. +func (b BicepSettingsResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", b.NextLink) + populate(objectMap, "value", b.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BicepSettingsResourceListResult. +func (b *BicepSettingsResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &b.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &b.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type BicepSettingsResourceUpdate. +func (b BicepSettingsResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", b.ID) + populate(objectMap, "name", b.Name) + populate(objectMap, "systemData", b.SystemData) + populate(objectMap, "tags", b.Tags) + populate(objectMap, "type", b.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type BicepSettingsResourceUpdate. +func (b *BicepSettingsResourceUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &b.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &b.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &b.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &b.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &b.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", b, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type EnvironmentCompute. func (e EnvironmentCompute) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) @@ -431,10 +746,12 @@ func (e *EnvironmentCompute) UnmarshalJSON(data []byte) error { // MarshalJSON implements the json.Marshaller interface for type EnvironmentProperties. func (e EnvironmentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) + populate(objectMap, "bicepSettings", e.BicepSettings) populate(objectMap, "providers", e.Providers) populate(objectMap, "provisioningState", e.ProvisioningState) populate(objectMap, "recipePacks", e.RecipePacks) populate(objectMap, "simulated", e.Simulated) + populate(objectMap, "terraformSettings", e.TerraformSettings) return json.Marshal(objectMap) } @@ -447,6 +764,9 @@ func (e *EnvironmentProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "bicepSettings": + err = unpopulate(val, "BicepSettings", &e.BicepSettings) + delete(rawMsg, key) case "providers": err = unpopulate(val, "Providers", &e.Providers) delete(rawMsg, key) @@ -459,6 +779,9 @@ func (e *EnvironmentProperties) UnmarshalJSON(data []byte) error { case "simulated": err = unpopulate(val, "Simulated", &e.Simulated) delete(rawMsg, key) + case "terraformSettings": + err = unpopulate(val, "TerraformSettings", &e.TerraformSettings) + delete(rawMsg, key) } if err != nil { return fmt.Errorf("unmarshalling type %T: %v", e, err) @@ -1398,6 +1721,406 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { return nil } +// MarshalJSON implements the json.Marshaller interface for type TerraformBackendConfiguration. +func (t TerraformBackendConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "config", t.Config) + populate(objectMap, "type", t.Type) + if t.AdditionalProperties != nil { + for key, val := range t.AdditionalProperties { + objectMap[key] = val + } + } + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerraformBackendConfiguration. +func (t *TerraformBackendConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "config": + err = unpopulate(val, "Config", &t.Config) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + default: + if t.AdditionalProperties == nil { + t.AdditionalProperties = map[string]any{} + } + if val != nil { + var aux any + err = json.Unmarshal(val, &aux) + t.AdditionalProperties[key] = aux + } + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TerraformCliConfiguration. +func (t TerraformCliConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "credentials", t.Credentials) + populate(objectMap, "provider_installation", t.ProviderInstallation) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerraformCliConfiguration. +func (t *TerraformCliConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "credentials": + err = unpopulate(val, "Credentials", &t.Credentials) + delete(rawMsg, key) + case "provider_installation": + err = unpopulate(val, "ProviderInstallation", &t.ProviderInstallation) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TerraformCredentialConfiguration. +func (t TerraformCredentialConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "secret", t.Secret) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerraformCredentialConfiguration. +func (t *TerraformCredentialConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "secret": + err = unpopulate(val, "Secret", &t.Secret) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TerraformDirectConfiguration. +func (t TerraformDirectConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "exclude", t.Exclude) + populate(objectMap, "include", t.Include) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerraformDirectConfiguration. +func (t *TerraformDirectConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "exclude": + err = unpopulate(val, "Exclude", &t.Exclude) + delete(rawMsg, key) + case "include": + err = unpopulate(val, "Include", &t.Include) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TerraformLoggingConfiguration. +func (t TerraformLoggingConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "level", t.Level) + populate(objectMap, "path", t.Path) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerraformLoggingConfiguration. +func (t *TerraformLoggingConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "level": + err = unpopulate(val, "Level", &t.Level) + delete(rawMsg, key) + case "path": + err = unpopulate(val, "Path", &t.Path) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TerraformNetworkMirrorConfiguration. +func (t TerraformNetworkMirrorConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "exclude", t.Exclude) + populate(objectMap, "include", t.Include) + populate(objectMap, "url", t.URL) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerraformNetworkMirrorConfiguration. +func (t *TerraformNetworkMirrorConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "exclude": + err = unpopulate(val, "Exclude", &t.Exclude) + delete(rawMsg, key) + case "include": + err = unpopulate(val, "Include", &t.Include) + delete(rawMsg, key) + case "url": + err = unpopulate(val, "URL", &t.URL) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TerraformProviderInstallationConfiguration. +func (t TerraformProviderInstallationConfiguration) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "direct", t.Direct) + populate(objectMap, "network_mirror", t.NetworkMirror) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerraformProviderInstallationConfiguration. +func (t *TerraformProviderInstallationConfiguration) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "direct": + err = unpopulate(val, "Direct", &t.Direct) + delete(rawMsg, key) + case "network_mirror": + err = unpopulate(val, "NetworkMirror", &t.NetworkMirror) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TerraformSettingsProperties. +func (t TerraformSettingsProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "backend", t.Backend) + populate(objectMap, "env", t.Env) + populate(objectMap, "logging", t.Logging) + populate(objectMap, "provisioningState", t.ProvisioningState) + populate(objectMap, "terraformrc", t.Terraformrc) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerraformSettingsProperties. +func (t *TerraformSettingsProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "backend": + err = unpopulate(val, "Backend", &t.Backend) + delete(rawMsg, key) + case "env": + err = unpopulate(val, "Env", &t.Env) + delete(rawMsg, key) + case "logging": + err = unpopulate(val, "Logging", &t.Logging) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, "ProvisioningState", &t.ProvisioningState) + delete(rawMsg, key) + case "terraformrc": + err = unpopulate(val, "Terraformrc", &t.Terraformrc) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TerraformSettingsResource. +func (t TerraformSettingsResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "location", t.Location) + populate(objectMap, "name", t.Name) + populate(objectMap, "properties", t.Properties) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerraformSettingsResource. +func (t *TerraformSettingsResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "location": + err = unpopulate(val, "Location", &t.Location) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, "Properties", &t.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TerraformSettingsResourceListResult. +func (t TerraformSettingsResourceListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "nextLink", t.NextLink) + populate(objectMap, "value", t.Value) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerraformSettingsResourceListResult. +func (t *TerraformSettingsResourceListResult) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "nextLink": + err = unpopulate(val, "NextLink", &t.NextLink) + delete(rawMsg, key) + case "value": + err = unpopulate(val, "Value", &t.Value) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + +// MarshalJSON implements the json.Marshaller interface for type TerraformSettingsResourceUpdate. +func (t TerraformSettingsResourceUpdate) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]any) + populate(objectMap, "id", t.ID) + populate(objectMap, "name", t.Name) + populate(objectMap, "systemData", t.SystemData) + populate(objectMap, "tags", t.Tags) + populate(objectMap, "type", t.Type) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type TerraformSettingsResourceUpdate. +func (t *TerraformSettingsResourceUpdate) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, "ID", &t.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, "Name", &t.Name) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, "SystemData", &t.SystemData) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, "Tags", &t.Tags) + delete(rawMsg, key) + case "type": + err = unpopulate(val, "Type", &t.Type) + delete(rawMsg, key) + } + if err != nil { + return fmt.Errorf("unmarshalling type %T: %v", t, err) + } + } + return nil +} + // MarshalJSON implements the json.Marshaller interface for type TrackedResource. func (t TrackedResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]any) diff --git a/pkg/corerp/api/v20250801preview/zz_generated_options.go b/pkg/corerp/api/v20250801preview/zz_generated_options.go index 25fe2b8409..88bedc6d88 100644 --- a/pkg/corerp/api/v20250801preview/zz_generated_options.go +++ b/pkg/corerp/api/v20250801preview/zz_generated_options.go @@ -34,6 +34,32 @@ type ApplicationsClientUpdateOptions struct { // placeholder for future optional parameters } +// BicepSettingsClientCreateOrUpdateOptions contains the optional parameters for the BicepSettingsClient.CreateOrUpdate method. +type BicepSettingsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// BicepSettingsClientDeleteOptions contains the optional parameters for the BicepSettingsClient.Delete method. +type BicepSettingsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// BicepSettingsClientGetOptions contains the optional parameters for the BicepSettingsClient.Get method. +type BicepSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// BicepSettingsClientListByScopeOptions contains the optional parameters for the BicepSettingsClient.NewListByScopePager +// method. +type BicepSettingsClientListByScopeOptions struct { + // placeholder for future optional parameters +} + +// BicepSettingsClientUpdateOptions contains the optional parameters for the BicepSettingsClient.Update method. +type BicepSettingsClientUpdateOptions struct { + // placeholder for future optional parameters +} + // EnvironmentsClientCreateOrUpdateOptions contains the optional parameters for the EnvironmentsClient.CreateOrUpdate method. type EnvironmentsClientCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -88,3 +114,30 @@ type RecipePacksClientListByScopeOptions struct { type RecipePacksClientUpdateOptions struct { // placeholder for future optional parameters } + +// TerraformSettingsClientCreateOrUpdateOptions contains the optional parameters for the TerraformSettingsClient.CreateOrUpdate +// method. +type TerraformSettingsClientCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// TerraformSettingsClientDeleteOptions contains the optional parameters for the TerraformSettingsClient.Delete method. +type TerraformSettingsClientDeleteOptions struct { + // placeholder for future optional parameters +} + +// TerraformSettingsClientGetOptions contains the optional parameters for the TerraformSettingsClient.Get method. +type TerraformSettingsClientGetOptions struct { + // placeholder for future optional parameters +} + +// TerraformSettingsClientListByScopeOptions contains the optional parameters for the TerraformSettingsClient.NewListByScopePager +// method. +type TerraformSettingsClientListByScopeOptions struct { + // placeholder for future optional parameters +} + +// TerraformSettingsClientUpdateOptions contains the optional parameters for the TerraformSettingsClient.Update method. +type TerraformSettingsClientUpdateOptions struct { + // placeholder for future optional parameters +} diff --git a/pkg/corerp/api/v20250801preview/zz_generated_responses.go b/pkg/corerp/api/v20250801preview/zz_generated_responses.go index 6038070cb6..0b1148926d 100644 --- a/pkg/corerp/api/v20250801preview/zz_generated_responses.go +++ b/pkg/corerp/api/v20250801preview/zz_generated_responses.go @@ -39,6 +39,35 @@ type ApplicationsClientUpdateResponse struct { ApplicationResource } +// BicepSettingsClientCreateOrUpdateResponse contains the response from method BicepSettingsClient.CreateOrUpdate. +type BicepSettingsClientCreateOrUpdateResponse struct { + // Bicep settings resource. + BicepSettingsResource +} + +// BicepSettingsClientDeleteResponse contains the response from method BicepSettingsClient.Delete. +type BicepSettingsClientDeleteResponse struct { + // placeholder for future response values +} + +// BicepSettingsClientGetResponse contains the response from method BicepSettingsClient.Get. +type BicepSettingsClientGetResponse struct { + // Bicep settings resource. + BicepSettingsResource +} + +// BicepSettingsClientListByScopeResponse contains the response from method BicepSettingsClient.NewListByScopePager. +type BicepSettingsClientListByScopeResponse struct { + // The response of a BicepSettingsResource list operation. + BicepSettingsResourceListResult +} + +// BicepSettingsClientUpdateResponse contains the response from method BicepSettingsClient.Update. +type BicepSettingsClientUpdateResponse struct { + // Bicep settings resource. + BicepSettingsResource +} + // EnvironmentsClientCreateOrUpdateResponse contains the response from method EnvironmentsClient.CreateOrUpdate. type EnvironmentsClientCreateOrUpdateResponse struct { // The environment resource @@ -102,3 +131,32 @@ type RecipePacksClientUpdateResponse struct { // The recipe pack resource RecipePackResource } + +// TerraformSettingsClientCreateOrUpdateResponse contains the response from method TerraformSettingsClient.CreateOrUpdate. +type TerraformSettingsClientCreateOrUpdateResponse struct { + // Terraform settings resource. + TerraformSettingsResource +} + +// TerraformSettingsClientDeleteResponse contains the response from method TerraformSettingsClient.Delete. +type TerraformSettingsClientDeleteResponse struct { + // placeholder for future response values +} + +// TerraformSettingsClientGetResponse contains the response from method TerraformSettingsClient.Get. +type TerraformSettingsClientGetResponse struct { + // Terraform settings resource. + TerraformSettingsResource +} + +// TerraformSettingsClientListByScopeResponse contains the response from method TerraformSettingsClient.NewListByScopePager. +type TerraformSettingsClientListByScopeResponse struct { + // The response of a TerraformSettingsResource list operation. + TerraformSettingsResourceListResult +} + +// TerraformSettingsClientUpdateResponse contains the response from method TerraformSettingsClient.Update. +type TerraformSettingsClientUpdateResponse struct { + // Terraform settings resource. + TerraformSettingsResource +} diff --git a/pkg/corerp/api/v20250801preview/zz_generated_terraformsettings_client.go b/pkg/corerp/api/v20250801preview/zz_generated_terraformsettings_client.go new file mode 100644 index 0000000000..19b7e26a68 --- /dev/null +++ b/pkg/corerp/api/v20250801preview/zz_generated_terraformsettings_client.go @@ -0,0 +1,310 @@ +// Licensed under the Apache License, Version 2.0 . See LICENSE in the repository root for license information. +// Code generated by Microsoft (R) AutoRest Code Generator. DO NOT EDIT. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +package v20250801preview + +import ( + "context" + "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// TerraformSettingsClient contains the methods for the TerraformSettings group. +// Don't use this type directly, use NewTerraformSettingsClient() instead. +type TerraformSettingsClient struct { + internal *arm.Client + rootScope string +} + +// NewTerraformSettingsClient creates a new instance of TerraformSettingsClient with the specified values. +// - rootScope - The scope in which the resource is present. UCP Scope is /planes/{planeType}/{planeName}/resourceGroup/{resourcegroupID} +// and Azure resource scope is +// /subscriptions/{subscriptionID}/resourceGroup/{resourcegroupID} +// - credential - used to authorize requests. Usually a credential from azidentity. +// - options - pass nil to accept the default values. +func NewTerraformSettingsClient(rootScope string, credential azcore.TokenCredential, options *arm.ClientOptions) (*TerraformSettingsClient, error) { + cl, err := arm.NewClient(moduleName, moduleVersion, credential, options) + if err != nil { + return nil, err + } + client := &TerraformSettingsClient{ + rootScope: rootScope, + internal: cl, + } + return client, nil +} + +// CreateOrUpdate - Create a TerraformSettingsResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-08-01-preview +// - terraformSettingsName - Terraform settings resource name. +// - resource - Resource create parameters. +// - options - TerraformSettingsClientCreateOrUpdateOptions contains the optional parameters for the TerraformSettingsClient.CreateOrUpdate +// method. +func (client *TerraformSettingsClient) CreateOrUpdate(ctx context.Context, terraformSettingsName string, resource TerraformSettingsResource, options *TerraformSettingsClientCreateOrUpdateOptions) (TerraformSettingsClientCreateOrUpdateResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "TerraformSettingsClient.CreateOrUpdate", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.createOrUpdateCreateRequest(ctx, terraformSettingsName, resource, options) + if err != nil { + return TerraformSettingsClientCreateOrUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TerraformSettingsClientCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusCreated) { + err = runtime.NewResponseError(httpResp) + return TerraformSettingsClientCreateOrUpdateResponse{}, err + } + resp, err := client.createOrUpdateHandleResponse(httpResp) + return resp, err +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *TerraformSettingsClient) createOrUpdateCreateRequest(ctx context.Context, terraformSettingsName string, resource TerraformSettingsResource, _ *TerraformSettingsClientCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/{rootScope}/providers/Radius.Core/terraformSettings/{terraformSettingsName}" + urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) + if terraformSettingsName == "" { + return nil, errors.New("parameter terraformSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{terraformSettingsName}", url.PathEscape(terraformSettingsName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, resource); err != nil { + return nil, err + } + return req, nil +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *TerraformSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (TerraformSettingsClientCreateOrUpdateResponse, error) { + result := TerraformSettingsClientCreateOrUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TerraformSettingsResource); err != nil { + return TerraformSettingsClientCreateOrUpdateResponse{}, err + } + return result, nil +} + +// Delete - Delete a TerraformSettingsResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-08-01-preview +// - terraformSettingsName - Terraform settings resource name. +// - options - TerraformSettingsClientDeleteOptions contains the optional parameters for the TerraformSettingsClient.Delete +// method. +func (client *TerraformSettingsClient) Delete(ctx context.Context, terraformSettingsName string, options *TerraformSettingsClientDeleteOptions) (TerraformSettingsClientDeleteResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "TerraformSettingsClient.Delete", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.deleteCreateRequest(ctx, terraformSettingsName, options) + if err != nil { + return TerraformSettingsClientDeleteResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TerraformSettingsClientDeleteResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK, http.StatusNoContent) { + err = runtime.NewResponseError(httpResp) + return TerraformSettingsClientDeleteResponse{}, err + } + return TerraformSettingsClientDeleteResponse{}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *TerraformSettingsClient) deleteCreateRequest(ctx context.Context, terraformSettingsName string, _ *TerraformSettingsClientDeleteOptions) (*policy.Request, error) { + urlPath := "/{rootScope}/providers/Radius.Core/terraformSettings/{terraformSettingsName}" + urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) + if terraformSettingsName == "" { + return nil, errors.New("parameter terraformSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{terraformSettingsName}", url.PathEscape(terraformSettingsName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// Get - Get a TerraformSettingsResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-08-01-preview +// - terraformSettingsName - Terraform settings resource name. +// - options - TerraformSettingsClientGetOptions contains the optional parameters for the TerraformSettingsClient.Get method. +func (client *TerraformSettingsClient) Get(ctx context.Context, terraformSettingsName string, options *TerraformSettingsClientGetOptions) (TerraformSettingsClientGetResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "TerraformSettingsClient.Get", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.getCreateRequest(ctx, terraformSettingsName, options) + if err != nil { + return TerraformSettingsClientGetResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TerraformSettingsClientGetResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TerraformSettingsClientGetResponse{}, err + } + resp, err := client.getHandleResponse(httpResp) + return resp, err +} + +// getCreateRequest creates the Get request. +func (client *TerraformSettingsClient) getCreateRequest(ctx context.Context, terraformSettingsName string, _ *TerraformSettingsClientGetOptions) (*policy.Request, error) { + urlPath := "/{rootScope}/providers/Radius.Core/terraformSettings/{terraformSettingsName}" + urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) + if terraformSettingsName == "" { + return nil, errors.New("parameter terraformSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{terraformSettingsName}", url.PathEscape(terraformSettingsName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *TerraformSettingsClient) getHandleResponse(resp *http.Response) (TerraformSettingsClientGetResponse, error) { + result := TerraformSettingsClientGetResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TerraformSettingsResource); err != nil { + return TerraformSettingsClientGetResponse{}, err + } + return result, nil +} + +// NewListByScopePager - List TerraformSettingsResource resources by Scope +// +// Generated from API version 2025-08-01-preview +// - options - TerraformSettingsClientListByScopeOptions contains the optional parameters for the TerraformSettingsClient.NewListByScopePager +// method. +func (client *TerraformSettingsClient) NewListByScopePager(options *TerraformSettingsClientListByScopeOptions) *runtime.Pager[TerraformSettingsClientListByScopeResponse] { + return runtime.NewPager(runtime.PagingHandler[TerraformSettingsClientListByScopeResponse]{ + More: func(page TerraformSettingsClientListByScopeResponse) bool { + return page.NextLink != nil && len(*page.NextLink) > 0 + }, + Fetcher: func(ctx context.Context, page *TerraformSettingsClientListByScopeResponse) (TerraformSettingsClientListByScopeResponse, error) { + nextLink := "" + if page != nil { + nextLink = *page.NextLink + } + resp, err := runtime.FetcherForNextLink(ctx, client.internal.Pipeline(), nextLink, func(ctx context.Context) (*policy.Request, error) { + return client.listByScopeCreateRequest(ctx, options) + }, nil) + if err != nil { + return TerraformSettingsClientListByScopeResponse{}, err + } + return client.listByScopeHandleResponse(resp) + }, + Tracer: client.internal.Tracer(), + }) +} + +// listByScopeCreateRequest creates the ListByScope request. +func (client *TerraformSettingsClient) listByScopeCreateRequest(ctx context.Context, _ *TerraformSettingsClientListByScopeOptions) (*policy.Request, error) { + urlPath := "/{rootScope}/providers/Radius.Core/terraformSettings" + urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + return req, nil +} + +// listByScopeHandleResponse handles the ListByScope response. +func (client *TerraformSettingsClient) listByScopeHandleResponse(resp *http.Response) (TerraformSettingsClientListByScopeResponse, error) { + result := TerraformSettingsClientListByScopeResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TerraformSettingsResourceListResult); err != nil { + return TerraformSettingsClientListByScopeResponse{}, err + } + return result, nil +} + +// Update - Update a TerraformSettingsResource +// If the operation fails it returns an *azcore.ResponseError type. +// +// Generated from API version 2025-08-01-preview +// - terraformSettingsName - Terraform settings resource name. +// - properties - The resource properties to be updated. +// - options - TerraformSettingsClientUpdateOptions contains the optional parameters for the TerraformSettingsClient.Update +// method. +func (client *TerraformSettingsClient) Update(ctx context.Context, terraformSettingsName string, properties TerraformSettingsResourceUpdate, options *TerraformSettingsClientUpdateOptions) (TerraformSettingsClientUpdateResponse, error) { + var err error + ctx, endSpan := runtime.StartSpan(ctx, "TerraformSettingsClient.Update", client.internal.Tracer(), nil) + defer func() { endSpan(err) }() + req, err := client.updateCreateRequest(ctx, terraformSettingsName, properties, options) + if err != nil { + return TerraformSettingsClientUpdateResponse{}, err + } + httpResp, err := client.internal.Pipeline().Do(req) + if err != nil { + return TerraformSettingsClientUpdateResponse{}, err + } + if !runtime.HasStatusCode(httpResp, http.StatusOK) { + err = runtime.NewResponseError(httpResp) + return TerraformSettingsClientUpdateResponse{}, err + } + resp, err := client.updateHandleResponse(httpResp) + return resp, err +} + +// updateCreateRequest creates the Update request. +func (client *TerraformSettingsClient) updateCreateRequest(ctx context.Context, terraformSettingsName string, properties TerraformSettingsResourceUpdate, _ *TerraformSettingsClientUpdateOptions) (*policy.Request, error) { + urlPath := "/{rootScope}/providers/Radius.Core/terraformSettings/{terraformSettingsName}" + urlPath = strings.ReplaceAll(urlPath, "{rootScope}", client.rootScope) + if terraformSettingsName == "" { + return nil, errors.New("parameter terraformSettingsName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{terraformSettingsName}", url.PathEscape(terraformSettingsName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.internal.Endpoint(), urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2025-08-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header["Accept"] = []string{"application/json"} + if err := runtime.MarshalAsJSON(req, properties); err != nil { + return nil, err + } + return req, nil +} + +// updateHandleResponse handles the Update response. +func (client *TerraformSettingsClient) updateHandleResponse(resp *http.Response) (TerraformSettingsClientUpdateResponse, error) { + result := TerraformSettingsClientUpdateResponse{} + if err := runtime.UnmarshalAsJSON(resp, &result.TerraformSettingsResource); err != nil { + return TerraformSettingsClientUpdateResponse{}, err + } + return result, nil +} diff --git a/pkg/corerp/datamodel/bicepsettings_v20250801preview.go b/pkg/corerp/datamodel/bicepsettings_v20250801preview.go new file mode 100644 index 0000000000..f61b2ed54a --- /dev/null +++ b/pkg/corerp/datamodel/bicepsettings_v20250801preview.go @@ -0,0 +1,72 @@ +/* +Copyright 2023 The Radius Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package datamodel + +import v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" + +const BicepSettingsResourceType_v20250801preview = "Radius.Core/bicepSettings" + +// BicepSettings_v20250801preview represents the Radius.Core/bicepSettings resource. +type BicepSettings_v20250801preview struct { + v1.BaseResource + + // Properties of the Bicep settings resource. + Properties BicepSettingsProperties_v20250801preview `json:"properties"` +} + +// ResourceTypeName returns the resource type for Bicep settings. +func (b *BicepSettings_v20250801preview) ResourceTypeName() string { + return BicepSettingsResourceType_v20250801preview +} + +// BicepSettingsProperties_v20250801preview describes the Bicep settings payload. +type BicepSettingsProperties_v20250801preview struct { + // Authentication contains registry authentication entries keyed by hostname. + Authentication *BicepAuthenticationConfiguration `json:"authentication,omitempty"` +} + +// BicepAuthenticationConfiguration captures registry authentication entries. +type BicepAuthenticationConfiguration struct { + // Registries contains authentication configuration keyed by registry hostname. + Registries map[string]*BicepRegistryAuthentication `json:"registries,omitempty"` +} + +// BicepRegistryAuthentication holds supported auth mechanisms for a registry. +type BicepRegistryAuthentication struct { + Basic *BicepBasicAuthentication `json:"basic,omitempty"` + AzureWorkloadIdentity *BicepAzureWorkloadIdentityAuthentication `json:"azureWorkloadIdentity,omitempty"` + AwsIrsa *BicepAwsIrsaAuthentication `json:"awsIrsa,omitempty"` +} + +// BicepBasicAuthentication holds username/password auth settings. +type BicepBasicAuthentication struct { + Username string `json:"username,omitempty"` + Secret string `json:"secret,omitempty"` +} + +// BicepAzureWorkloadIdentityAuthentication holds Azure Workload Identity settings. +type BicepAzureWorkloadIdentityAuthentication struct { + ClientID string `json:"clientId,omitempty"` + TenantID string `json:"tenantId,omitempty"` + Secret string `json:"secret,omitempty"` +} + +// BicepAwsIrsaAuthentication holds AWS IRSA settings. +type BicepAwsIrsaAuthentication struct { + RoleArn string `json:"roleArn,omitempty"` + Secret string `json:"secret,omitempty"` +} diff --git a/pkg/corerp/datamodel/environment_v20250801preview.go b/pkg/corerp/datamodel/environment_v20250801preview.go index 2dba1da6f8..6610fc6743 100644 --- a/pkg/corerp/datamodel/environment_v20250801preview.go +++ b/pkg/corerp/datamodel/environment_v20250801preview.go @@ -38,6 +38,12 @@ func (e *Environment_v20250801preview) ResourceTypeName() string { // EnvironmentProperties_v20250801preview represents the properties of the new environment schema. type EnvironmentProperties_v20250801preview struct { + // TerraformSettings is the resource ID of the Terraform settings applied to this environment. + TerraformSettings string `json:"terraformSettings,omitempty"` + + // BicepSettings is the resource ID of the Bicep settings applied to this environment. + BicepSettings string `json:"bicepSettings,omitempty"` + // RecipePacks is the list of recipe pack resource IDs linked to this environment. RecipePacks []string `json:"recipePacks,omitempty"` diff --git a/pkg/corerp/datamodel/recipe_types.go b/pkg/corerp/datamodel/recipe_types.go index 57de21a29d..c6d7fa6494 100644 --- a/pkg/corerp/datamodel/recipe_types.go +++ b/pkg/corerp/datamodel/recipe_types.go @@ -40,6 +40,15 @@ type TerraformConfigProperties struct { // Providers specifies the Terraform provider configurations. Controls how Terraform interacts with cloud providers, SaaS providers, and other APIs: https://developer.hashicorp.com/terraform/language/providers/configuration.// Providers specifies the Terraform provider configurations. Providers map[string][]ProviderConfigProperties `json:"providers,omitempty"` + + // ProviderMirror specifies the Terraform provider mirror configuration. + ProviderMirror *TerraformProviderMirrorConfig `json:"providerMirror,omitempty"` + + // ModuleRegistries specifies configuration for Terraform module registries (e.g., Terraform Cloud/Enterprise). + ModuleRegistries map[string]*TerraformModuleRegistryConfig `json:"moduleRegistries,omitempty"` + + // Version specifies the Terraform binary version and the URL to download it from. + Version *TerraformVersionConfig `json:"version,omitempty"` } // BicepConfigProperties - Configuration for Bicep Recipes. Controls how Bicep plans and applies templates as part of Recipe @@ -48,6 +57,9 @@ type BicepConfigProperties struct { // Authentication holds the information used to access private bicep registries, which is a map of registry hostname to secret config // that contains credential information. Authentication map[string]RegistrySecretConfig + + // RegistryAuthentication contains richer authentication data keyed by registry hostname (Basic, Azure Workload Identity, AWS IRSA). + RegistryAuthentication map[string]*BicepRegistryAuthentication `json:"registryAuthentication,omitempty"` } // RegistrySecretConfig - Registry Secret Configuration used to authenticate to private bicep registries. @@ -77,6 +89,14 @@ type SecretConfig struct { Secret string `json:"secret,omitempty"` } +// ClientCertConfig - Client certificate (mTLS) configuration for authentication. +type ClientCertConfig struct { + // The ID of an Applications.Core/SecretStore resource containing the client certificate and key. + // The secret store must have secrets named 'cert' and 'key' containing the PEM-encoded certificate and private key. + // A secret named 'passphrase' is optional, containing the passphrase for the private key. + Secret string `json:"secret,omitempty"` +} + // EnvironmentVariables represents the environment variables to be set for the recipe execution. type EnvironmentVariables struct { // AdditionalProperties represents the non-sensitive environment variables to be set for the recipe execution. @@ -99,3 +119,84 @@ type SecretReference struct { // Key represents the key of the secret. Key string `json:"key"` } + +// TerraformProviderMirrorConfig - Configuration for Terraform provider mirrors. +type TerraformProviderMirrorConfig struct { + // Type of mirror. DEPRECATED: This field is deprecated. All provider mirrors now use the network mirror protocol. + Type string `json:"type,omitempty"` + + // URL to the mirror server implementing the provider network mirror protocol. + URL string `json:"url,omitempty"` + + // ProviderMappings is used to translate between official and custom provider identifiers. + ProviderMappings map[string]string `json:"providerMappings,omitempty"` + + // Authentication configuration for accessing private Terraform provider mirrors. + Authentication RegistryAuthConfig `json:"authentication,omitempty"` + + // TLS configuration for connecting to the Terraform provider registry mirror or for downloading the filesystem mirror. + TLS *TLSConfig `json:"tls,omitempty"` +} + +// TerraformModuleRegistryConfig - Configuration for Terraform module registries. +type TerraformModuleRegistryConfig struct { + // URL is the URL of the module registry. + // Example: 'app.terraform.io' for Terraform Cloud or 'terraform.example.com' for Terraform Enterprise + URL string `json:"url,omitempty"` + + // Authentication configuration for accessing private module registries. + Authentication RegistryAuthConfig `json:"authentication,omitempty"` + + // TLS configuration for connecting to the module registry. + TLS *TLSConfig `json:"tls,omitempty"` +} + +// TokenConfig - Token authentication configuration. +type TokenConfig struct { + // The ID of an Applications.Core/SecretStore resource containing the authentication token. + // The secret store must have a secret named 'token' containing the token value. + Secret string `json:"secret,omitempty"` +} + +// RegistryAuthConfig - Authentication configuration for accessing private Terraform registries (both provider and module registries). +type RegistryAuthConfig struct { + // Token is the token authentication configuration for registry authentication. + Token *TokenConfig `json:"token,omitempty"` + + // AdditionalHosts is a list of additional hosts that should use the same authentication credentials. + // This is useful when a registry mirror redirects to other hosts (e.g., GitLab Pages mirrors redirecting to gitlab.com). + AdditionalHosts []string `json:"additionalHosts,omitempty"` +} + +// TerraformVersionConfig - Configuration for Terraform binary. +type TerraformVersionConfig struct { + // Version is the version of the Terraform binary to use. Example: '1.0.0'. + // If omitted, the system may default to the latest stable version. + Version string `json:"version,omitempty"` + + // ReleasesArchiveURL is an optional direct URL to a Terraform binary archive (.zip file). + // If set, Terraform will be downloaded directly from this URL instead of using the releases API. + // This takes precedence over ReleasesAPIBaseURL. + // The URL must point to a valid Terraform release archive. + // Example: 'https://my-mirror.example.com/terraform/1.7.0/terraform_1.7.0_linux_amd64.zip' + ReleasesArchiveURL string `json:"releasesArchiveUrl,omitempty"` + + // ReleasesAPIBaseURL is an optional base URL for a custom Terraform releases API. + // If set, Terraform will be downloaded from this base URL instead of the default HashiCorp releases site. + // The directory structure of the custom URL must match the HashiCorp releases site (including the index.json files). + // Example: 'https://my-terraform-mirror.example.com' + ReleasesAPIBaseURL string `json:"releasesApiBaseUrl,omitempty"` + + // TLS contains TLS configuration for connecting to the releases API. + TLS *TLSConfig `json:"tls,omitempty"` + + // Authentication configuration for accessing the Terraform binary releases API. + Authentication *RegistryAuthConfig `json:"authentication,omitempty"` +} + +// TLSConfig - TLS configuration options for HTTPS connections. +type TLSConfig struct { + // CACertificate is a reference to a secret containing a custom CA certificate bundle to use for TLS verification. + // The secret must contain a key named 'ca-cert' with the PEM-encoded certificate bundle. + CACertificate *SecretReference `json:"caCertificate,omitempty"` +} diff --git a/pkg/corerp/datamodel/terraformsettings_v20250801preview.go b/pkg/corerp/datamodel/terraformsettings_v20250801preview.go new file mode 100644 index 0000000000..ca9a2a5af8 --- /dev/null +++ b/pkg/corerp/datamodel/terraformsettings_v20250801preview.go @@ -0,0 +1,103 @@ +/* +Copyright 2023 The Radius Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package datamodel + +import v1 "github.com/radius-project/radius/pkg/armrpc/api/v1" + +const TerraformSettingsResourceType_v20250801preview = "Radius.Core/terraformSettings" + +// TerraformSettings_v20250801preview represents the Radius.Core/terraformSettings resource. +type TerraformSettings_v20250801preview struct { + v1.BaseResource + + // Properties of the Terraform settings resource. + Properties TerraformSettingsProperties_v20250801preview `json:"properties"` +} + +// ResourceTypeName returns the resource type for Terraform settings. +func (t *TerraformSettings_v20250801preview) ResourceTypeName() string { + return TerraformSettingsResourceType_v20250801preview +} + +// TerraformSettingsProperties_v20250801preview describes the Terraform settings payload. +type TerraformSettingsProperties_v20250801preview struct { + // TerraformRC mirrors the terraformrc file shape (provider mirrors, credentials). + TerraformRC *TerraformCliConfiguration `json:"terraformrc,omitempty"` + + // Backend configuration matching the Terraform backend block. + Backend *TerraformBackendConfiguration `json:"backend,omitempty"` + + // Env contains environment variables passed to Terraform executions. + Env map[string]string `json:"env,omitempty"` + + // Logging controls Terraform logging behaviour (TF_LOG/TF_LOG_PATH). + Logging *TerraformLoggingConfiguration `json:"logging,omitempty"` +} + +// TerraformCliConfiguration mirrors the terraformrc provider installation + credentials sections. +type TerraformCliConfiguration struct { + ProviderInstallation *TerraformProviderInstallationConfiguration `json:"provider_installation,omitempty"` + Credentials map[string]*TerraformCredentialConfiguration `json:"credentials,omitempty"` +} + +// TerraformProviderInstallationConfiguration describes network mirror and direct rules. +type TerraformProviderInstallationConfiguration struct { + NetworkMirror *TerraformNetworkMirrorConfiguration `json:"network_mirror,omitempty"` + Direct *TerraformDirectConfiguration `json:"direct,omitempty"` +} + +// TerraformNetworkMirrorConfiguration describes a network mirror entry. +type TerraformNetworkMirrorConfiguration struct { + URL string `json:"url"` + Include []string `json:"include,omitempty"` + Exclude []string `json:"exclude,omitempty"` +} + +// TerraformDirectInstallationConfiguration controls direct installation rules. +type TerraformDirectConfiguration struct { + Include []string `json:"include,omitempty"` + Exclude []string `json:"exclude,omitempty"` +} + +// TerraformCredentialConfiguration describes credentials keyed by hostname. +type TerraformCredentialConfiguration struct { + Secret string `json:"secret,omitempty"` +} + +// TerraformBackendConfiguration mirrors the Terraform backend block (type + config). +type TerraformBackendConfiguration struct { + Type string `json:"type"` + Config map[string]any `json:"config,omitempty"` +} + +// TerraformLoggingConfiguration captures TF_LOG/TF_LOG_PATH settings. +type TerraformLoggingConfiguration struct { + Level TerraformLogLevel `json:"level,omitempty"` + Path string `json:"path,omitempty"` +} + +// TerraformLogLevel enumerates supported TF_LOG values. +type TerraformLogLevel string + +const ( + TerraformLogLevelTrace TerraformLogLevel = "TRACE" + TerraformLogLevelDebug TerraformLogLevel = "DEBUG" + TerraformLogLevelInfo TerraformLogLevel = "INFO" + TerraformLogLevelWarn TerraformLogLevel = "WARN" + TerraformLogLevelError TerraformLogLevel = "ERROR" + TerraformLogLevelFatal TerraformLogLevel = "FATAL" +) diff --git a/swagger/specification/radius/resource-manager/Radius.Core/preview/2025-08-01-preview/openapi.json b/swagger/specification/radius/resource-manager/Radius.Core/preview/2025-08-01-preview/openapi.json index 3c65cec7f1..56549c785c 100644 --- a/swagger/specification/radius/resource-manager/Radius.Core/preview/2025-08-01-preview/openapi.json +++ b/swagger/specification/radius/resource-manager/Radius.Core/preview/2025-08-01-preview/openapi.json @@ -48,6 +48,12 @@ { "name": "Environments" }, + { + "name": "TerraformSettings" + }, + { + "name": "BicepSettings" + }, { "name": "RecipePacks" } @@ -337,6 +343,218 @@ } } }, + "/{rootScope}/providers/Radius.Core/bicepSettings": { + "get": { + "operationId": "BicepSettings_ListByScope", + "tags": [ + "BicepSettings" + ], + "description": "List BicepSettingsResource resources by Scope", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RootScopeParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/BicepSettingsResourceListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + }, + "/{rootScope}/providers/Radius.Core/bicepSettings/{bicepSettingsName}": { + "get": { + "operationId": "BicepSettings_Get", + "tags": [ + "BicepSettings" + ], + "description": "Get a BicepSettingsResource", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RootScopeParameter" + }, + { + "name": "bicepSettingsName", + "in": "path", + "description": "Bicep settings resource name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/BicepSettingsResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + } + }, + "put": { + "operationId": "BicepSettings_CreateOrUpdate", + "tags": [ + "BicepSettings" + ], + "description": "Create a BicepSettingsResource", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RootScopeParameter" + }, + { + "name": "bicepSettingsName", + "in": "path", + "description": "Bicep settings resource name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/BicepSettingsResource" + } + } + ], + "responses": { + "200": { + "description": "Resource 'BicepSettingsResource' update operation succeeded", + "schema": { + "$ref": "#/definitions/BicepSettingsResource" + } + }, + "201": { + "description": "Resource 'BicepSettingsResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/BicepSettingsResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + } + }, + "patch": { + "operationId": "BicepSettings_Update", + "tags": [ + "BicepSettings" + ], + "description": "Update a BicepSettingsResource", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RootScopeParameter" + }, + { + "name": "bicepSettingsName", + "in": "path", + "description": "Bicep settings resource name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/BicepSettingsResourceUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/BicepSettingsResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + } + }, + "delete": { + "operationId": "BicepSettings_Delete", + "tags": [ + "BicepSettings" + ], + "description": "Delete a BicepSettingsResource", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RootScopeParameter" + }, + { + "name": "bicepSettingsName", + "in": "path", + "description": "Bicep settings resource name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + } + ], + "responses": { + "200": { + "description": "Resource deleted successfully." + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + } + } + }, "/{rootScope}/providers/Radius.Core/environments": { "get": { "operationId": "Environments_ListByScope", @@ -792,23 +1010,26 @@ } } }, - "/providers/Radius.Core/operations": { + "/{rootScope}/providers/Radius.Core/terraformSettings": { "get": { - "operationId": "Operations_List", + "operationId": "TerraformSettings_ListByScope", "tags": [ - "Operations" + "TerraformSettings" ], - "description": "List the operations for the provider", + "description": "List TerraformSettingsResource resources by Scope", "parameters": [ { "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RootScopeParameter" } ], "responses": { "200": { "description": "Azure operation completed successfully.", "schema": { - "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/OperationListResult" + "$ref": "#/definitions/TerraformSettingsResourceListResult" } }, "default": { @@ -822,45 +1043,254 @@ "nextLinkName": "nextLink" } } - } - }, - "definitions": { - "ApplicationGraphConnection": { - "type": "object", - "description": "Describes the connection between two resources.", - "properties": { - "id": { - "type": "string", - "description": "The resource ID " - }, - "direction": { - "$ref": "#/definitions/Direction", - "description": "The direction of the connection. 'Outbound' indicates this connection specifies the ID of the destination and 'Inbound' indicates indicates this connection specifies the ID of the source." - } - }, - "required": [ - "id", - "direction" - ] }, - "ApplicationGraphOutputResource": { - "type": "object", - "description": "Describes an output resource that comprises an application graph resource.", - "properties": { - "id": { - "type": "string", - "description": "The resource ID." - }, - "type": { - "type": "string", - "description": "The resource type." - }, - "name": { - "type": "string", - "description": "The resource name." + "/{rootScope}/providers/Radius.Core/terraformSettings/{terraformSettingsName}": { + "get": { + "operationId": "TerraformSettings_Get", + "tags": [ + "TerraformSettings" + ], + "description": "Get a TerraformSettingsResource", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RootScopeParameter" + }, + { + "name": "terraformSettingsName", + "in": "path", + "description": "Terraform settings resource name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/TerraformSettingsResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } } }, - "required": [ + "put": { + "operationId": "TerraformSettings_CreateOrUpdate", + "tags": [ + "TerraformSettings" + ], + "description": "Create a TerraformSettingsResource", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RootScopeParameter" + }, + { + "name": "terraformSettingsName", + "in": "path", + "description": "Terraform settings resource name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "resource", + "in": "body", + "description": "Resource create parameters.", + "required": true, + "schema": { + "$ref": "#/definitions/TerraformSettingsResource" + } + } + ], + "responses": { + "200": { + "description": "Resource 'TerraformSettingsResource' update operation succeeded", + "schema": { + "$ref": "#/definitions/TerraformSettingsResource" + } + }, + "201": { + "description": "Resource 'TerraformSettingsResource' create operation succeeded", + "schema": { + "$ref": "#/definitions/TerraformSettingsResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + } + }, + "patch": { + "operationId": "TerraformSettings_Update", + "tags": [ + "TerraformSettings" + ], + "description": "Update a TerraformSettingsResource", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RootScopeParameter" + }, + { + "name": "terraformSettingsName", + "in": "path", + "description": "Terraform settings resource name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + }, + { + "name": "properties", + "in": "body", + "description": "The resource properties to be updated.", + "required": true, + "schema": { + "$ref": "#/definitions/TerraformSettingsResourceUpdate" + } + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "#/definitions/TerraformSettingsResource" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + } + }, + "delete": { + "operationId": "TerraformSettings_Delete", + "tags": [ + "TerraformSettings" + ], + "description": "Delete a TerraformSettingsResource", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + }, + { + "$ref": "#/parameters/RootScopeParameter" + }, + { + "name": "terraformSettingsName", + "in": "path", + "description": "Terraform settings resource name.", + "required": true, + "type": "string", + "maxLength": 63, + "pattern": "^[A-Za-z]([-A-Za-z0-9]*[A-Za-z0-9])?$" + } + ], + "responses": { + "200": { + "description": "Resource deleted successfully." + }, + "204": { + "description": "Resource does not exist." + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + } + } + }, + "/providers/Radius.Core/operations": { + "get": { + "operationId": "Operations_List", + "tags": [ + "Operations" + ], + "description": "List the operations for the provider", + "parameters": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/parameters/ApiVersionParameter" + } + ], + "responses": { + "200": { + "description": "Azure operation completed successfully.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/OperationListResult" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/ErrorResponse" + } + } + }, + "x-ms-pageable": { + "nextLinkName": "nextLink" + } + } + } + }, + "definitions": { + "ApplicationGraphConnection": { + "type": "object", + "description": "Describes the connection between two resources.", + "properties": { + "id": { + "type": "string", + "description": "The resource ID " + }, + "direction": { + "$ref": "#/definitions/Direction", + "description": "The direction of the connection. 'Outbound' indicates this connection specifies the ID of the destination and 'Inbound' indicates indicates this connection specifies the ID of the source." + } + }, + "required": [ + "id", + "direction" + ] + }, + "ApplicationGraphOutputResource": { + "type": "object", + "description": "Describes an output resource that comprises an application graph resource.", + "properties": { + "id": { + "type": "string", + "description": "The resource ID." + }, + "type": { + "type": "string", + "description": "The resource type." + }, + "name": { + "type": "string", + "description": "The resource name." + } + }, + "required": [ "id", "type", "name" @@ -1044,6 +1474,151 @@ ], "x-ms-discriminator-value": "aci" }, + "BicepAuthenticationConfiguration": { + "type": "object", + "description": "Authentication configuration for Bicep registries.", + "properties": { + "registries": { + "type": "object", + "description": "Authentication entries keyed by registry hostname.", + "additionalProperties": { + "$ref": "#/definitions/BicepRegistryAuthentication" + } + } + } + }, + "BicepAwsIrsaAuthentication": { + "type": "object", + "description": "AWS IRSA configuration for a Bicep registry.", + "properties": { + "roleArn": { + "type": "string", + "description": "ARN of the AWS IAM role used for IRSA." + }, + "secret": { + "type": "string", + "description": "Resource ID of the Radius.Security/secrets entry containing the IRSA token." + } + } + }, + "BicepAzureWorkloadIdentityAuthentication": { + "type": "object", + "description": "Azure Workload Identity configuration for a Bicep registry.", + "properties": { + "clientId": { + "type": "string", + "description": "Client ID used for Azure Workload Identity." + }, + "tenantId": { + "type": "string", + "description": "Tenant ID used for Azure Workload Identity." + }, + "secret": { + "type": "string", + "description": "Resource ID of the Radius.Security/secrets entry containing the workload identity token." + } + } + }, + "BicepBasicAuthentication": { + "type": "object", + "description": "Basic authentication configuration for a Bicep registry.", + "properties": { + "username": { + "type": "string", + "description": "Username for basic authentication." + }, + "secret": { + "type": "string", + "description": "Resource ID of the Radius.Security/secrets entry containing the password." + } + } + }, + "BicepRegistryAuthentication": { + "type": "object", + "description": "Registry authentication options for a private Bicep registry.", + "properties": { + "basic": { + "$ref": "#/definitions/BicepBasicAuthentication", + "description": "Basic authentication settings for a registry." + }, + "azureWorkloadIdentity": { + "$ref": "#/definitions/BicepAzureWorkloadIdentityAuthentication", + "description": "Azure Workload Identity authentication settings for a registry." + }, + "awsIrsa": { + "$ref": "#/definitions/BicepAwsIrsaAuthentication", + "description": "AWS IRSA authentication settings for a registry." + } + } + }, + "BicepSettingsProperties": { + "type": "object", + "description": "Bicep settings properties.", + "properties": { + "provisioningState": { + "$ref": "#/definitions/ProvisioningState", + "description": "Provisioning state of the asynchronous operation.", + "readOnly": true + }, + "authentication": { + "$ref": "#/definitions/BicepAuthenticationConfiguration", + "description": "Authentication settings for private registries." + } + } + }, + "BicepSettingsResource": { + "type": "object", + "description": "Bicep settings resource.", + "properties": { + "properties": { + "$ref": "#/definitions/BicepSettingsProperties", + "description": "The resource-specific properties for this resource.", + "x-ms-client-flatten": true, + "x-ms-mutability": [ + "read", + "create" + ] + } + }, + "required": [ + "properties" + ], + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/TrackedResource" + } + ] + }, + "BicepSettingsResourceListResult": { + "type": "object", + "description": "The response of a BicepSettingsResource list operation.", + "properties": { + "value": { + "type": "array", + "description": "The BicepSettingsResource items on this page", + "items": { + "$ref": "#/definitions/BicepSettingsResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "BicepSettingsResourceUpdate": { + "type": "object", + "description": "Bicep settings resource.", + "allOf": [ + { + "$ref": "#/definitions/Azure.ResourceManager.CommonTypes.TrackedResourceUpdate" + } + ] + }, "Direction": { "type": "string", "description": "The direction of a connection.", @@ -1099,6 +1674,14 @@ "description": "The status of the asynchronous operation.", "readOnly": true }, + "terraformSettings": { + "type": "string", + "description": "Resource ID of the Terraform settings applied to this environment." + }, + "bicepSettings": { + "type": "string", + "description": "Resource ID of the Bicep settings applied to this environment." + }, "recipePacks": { "type": "array", "description": "List of Recipe Pack resource IDs linked to this environment.", @@ -1577,6 +2160,257 @@ "x-ms-identifiers": [] } } + }, + "TerraformBackendConfiguration": { + "type": "object", + "description": "Terraform backend configuration matching the terraform block.", + "properties": { + "type": { + "type": "string", + "description": "Backend type (for example 'kubernetes')." + }, + "config": { + "type": "object", + "description": "Backend-specific configuration values.", + "additionalProperties": {} + } + }, + "required": [ + "type" + ], + "allOf": [ + { + "type": "object", + "additionalProperties": {} + } + ] + }, + "TerraformCliConfiguration": { + "type": "object", + "description": "Terraform CLI configuration matching the terraformrc file.", + "properties": { + "provider_installation": { + "$ref": "#/definitions/TerraformProviderInstallationConfiguration", + "description": "Provider installation configuration controlling how Terraform installs providers." + }, + "credentials": { + "type": "object", + "description": "Credentials keyed by registry or module source hostname.", + "additionalProperties": { + "$ref": "#/definitions/TerraformCredentialConfiguration" + } + } + } + }, + "TerraformCredentialConfiguration": { + "type": "object", + "description": "Credential configuration for Terraform provider or module sources.", + "properties": { + "secret": { + "type": "string", + "description": "Resource ID of the Radius.Security/secrets entry containing the credential values (for example token)." + } + } + }, + "TerraformDirectConfiguration": { + "type": "object", + "description": "Direct installation configuration for Terraform providers.", + "properties": { + "include": { + "type": "array", + "description": "Provider addresses included when falling back to direct installation.", + "items": { + "type": "string" + } + }, + "exclude": { + "type": "array", + "description": "Provider addresses excluded from direct installation.", + "items": { + "type": "string" + } + } + } + }, + "TerraformLogLevel": { + "type": "string", + "description": "Terraform log verbosity levels.", + "enum": [ + "TRACE", + "DEBUG", + "INFO", + "WARN", + "ERROR", + "FATAL" + ], + "x-ms-enum": { + "name": "TerraformLogLevel", + "modelAsString": false, + "values": [ + { + "name": "trace", + "value": "TRACE" + }, + { + "name": "debug", + "value": "DEBUG" + }, + { + "name": "info", + "value": "INFO" + }, + { + "name": "warn", + "value": "WARN" + }, + { + "name": "error", + "value": "ERROR" + }, + { + "name": "fatal", + "value": "FATAL" + } + ] + } + }, + "TerraformLoggingConfiguration": { + "type": "object", + "description": "Logging options for Terraform executions.", + "properties": { + "level": { + "$ref": "#/definitions/TerraformLogLevel", + "description": "Terraform log verbosity (maps to TF_LOG)." + }, + "path": { + "type": "string", + "description": "Destination file path for Terraform logs (maps to TF_LOG_PATH)." + } + } + }, + "TerraformNetworkMirrorConfiguration": { + "type": "object", + "description": "Network mirror configuration for Terraform providers.", + "properties": { + "url": { + "type": "string", + "description": "Mirror URL used to download providers." + }, + "include": { + "type": "array", + "description": "Provider addresses included in this mirror.", + "items": { + "type": "string" + } + }, + "exclude": { + "type": "array", + "description": "Provider addresses excluded from this mirror.", + "items": { + "type": "string" + } + } + }, + "required": [ + "url" + ] + }, + "TerraformProviderInstallationConfiguration": { + "type": "object", + "description": "Provider installation options for Terraform.", + "properties": { + "network_mirror": { + "$ref": "#/definitions/TerraformNetworkMirrorConfiguration", + "description": "Network mirror configuration used to download providers." + }, + "direct": { + "$ref": "#/definitions/TerraformDirectConfiguration", + "description": "Direct installation rules controlling when Terraform reaches public registries." + } + } + }, + "TerraformSettingsProperties": { + "type": "object", + "description": "Terraform settings properties.", + "properties": { + "provisioningState": { + "$ref": "#/definitions/ProvisioningState", + "description": "Provisioning state of the asynchronous operation.", + "readOnly": true + }, + "terraformrc": { + "$ref": "#/definitions/TerraformCliConfiguration", + "description": "Terraform CLI configuration equivalent to the terraformrc file." + }, + "backend": { + "$ref": "#/definitions/TerraformBackendConfiguration", + "description": "Terraform backend configuration." + }, + "env": { + "type": "object", + "description": "Environment variables injected into the Terraform process.", + "additionalProperties": { + "type": "string" + } + }, + "logging": { + "$ref": "#/definitions/TerraformLoggingConfiguration", + "description": "Logging configuration applied to Terraform executions." + } + } + }, + "TerraformSettingsResource": { + "type": "object", + "description": "Terraform settings resource.", + "properties": { + "properties": { + "$ref": "#/definitions/TerraformSettingsProperties", + "description": "The resource-specific properties for this resource.", + "x-ms-client-flatten": true, + "x-ms-mutability": [ + "read", + "create" + ] + } + }, + "required": [ + "properties" + ], + "allOf": [ + { + "$ref": "../../../../../common-types/resource-management/v3/types.json#/definitions/TrackedResource" + } + ] + }, + "TerraformSettingsResourceListResult": { + "type": "object", + "description": "The response of a TerraformSettingsResource list operation.", + "properties": { + "value": { + "type": "array", + "description": "The TerraformSettingsResource items on this page", + "items": { + "$ref": "#/definitions/TerraformSettingsResource" + } + }, + "nextLink": { + "type": "string", + "format": "uri", + "description": "The link to the next page of items" + } + }, + "required": [ + "value" + ] + }, + "TerraformSettingsResourceUpdate": { + "type": "object", + "description": "Terraform settings resource.", + "allOf": [ + { + "$ref": "#/definitions/Azure.ResourceManager.CommonTypes.TrackedResourceUpdate" + } + ] } }, "parameters": { diff --git a/typespec/Radius.Core/bicepSettings.tsp b/typespec/Radius.Core/bicepSettings.tsp new file mode 100644 index 0000000000..fa536659f9 --- /dev/null +++ b/typespec/Radius.Core/bicepSettings.tsp @@ -0,0 +1,135 @@ +/* +Copyright 2023 The Radius Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import "@typespec/rest"; +import "@typespec/versioning"; +import "@typespec/openapi"; +import "@azure-tools/typespec-autorest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; + +import "../radius/v1/ucprootscope.tsp"; +import "../radius/v1/resources.tsp"; +import "../radius/v1/trackedresource.tsp"; + +using Azure.ResourceManager; +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Autorest; +using Azure.Core; +using OpenAPI; + +namespace Radius.Core; + +@doc("Bicep settings resource.") +model BicepSettingsResource + is TrackedResourceRequired { + @doc("Bicep settings resource name.") + @key("bicepSettingsName") + @path + @segment("bicepSettings") + name: ResourceNameString; +} + +@doc("Bicep settings properties.") +model BicepSettingsProperties { + @doc("Provisioning state of the asynchronous operation.") + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; + + @doc("Authentication settings for private registries.") + authentication?: BicepAuthenticationConfiguration; +} + +@doc("Authentication configuration for Bicep registries.") +model BicepAuthenticationConfiguration { + @doc("Authentication entries keyed by registry hostname.") + registries?: Record; +} + +@doc("Registry authentication options for a private Bicep registry.") +model BicepRegistryAuthentication { + @doc("Basic authentication settings for a registry.") + basic?: BicepBasicAuthentication; + + @doc("Azure Workload Identity authentication settings for a registry.") + azureWorkloadIdentity?: BicepAzureWorkloadIdentityAuthentication; + + @doc("AWS IRSA authentication settings for a registry.") + awsIrsa?: BicepAwsIrsaAuthentication; +} + +@doc("Basic authentication configuration for a Bicep registry.") +model BicepBasicAuthentication { + @doc("Username for basic authentication.") + username?: string; + + @doc("Resource ID of the Radius.Security/secrets entry containing the password.") + secret?: string; +} + +@doc("Azure Workload Identity configuration for a Bicep registry.") +model BicepAzureWorkloadIdentityAuthentication { + @doc("Client ID used for Azure Workload Identity.") + clientId?: string; + + @doc("Tenant ID used for Azure Workload Identity.") + tenantId?: string; + + @doc("Resource ID of the Radius.Security/secrets entry containing the workload identity token.") + secret?: string; +} + +@doc("AWS IRSA configuration for a Bicep registry.") +model BicepAwsIrsaAuthentication { + @doc("ARN of the AWS IAM role used for IRSA.") + roleArn?: string; + + @doc("Resource ID of the Radius.Security/secrets entry containing the IRSA token.") + secret?: string; +} + +@armResourceOperations +interface BicepSettings { + get is ArmResourceRead< + BicepSettingsResource, + UCPBaseParameters + >; + + createOrUpdate is ArmResourceCreateOrReplaceSync< + BicepSettingsResource, + UCPBaseParameters + >; + + update is ArmResourcePatchSync< + BicepSettingsResource, + BicepSettingsProperties, + UCPBaseParameters + >; + + delete is ArmResourceDeleteSync< + BicepSettingsResource, + UCPBaseParameters + >; + + listByScope is ArmResourceListByParent< + BicepSettingsResource, + UCPBaseParameters, + "Scope", + "Scope" + >; +} diff --git a/typespec/Radius.Core/environments.tsp b/typespec/Radius.Core/environments.tsp index ee33c28dd6..8854c48d91 100644 --- a/typespec/Radius.Core/environments.tsp +++ b/typespec/Radius.Core/environments.tsp @@ -51,6 +51,12 @@ model EnvironmentProperties { @visibility(Lifecycle.Read) provisioningState?: ProvisioningState; + @doc("Resource ID of the Terraform settings applied to this environment.") + terraformSettings?: string; + + @doc("Resource ID of the Bicep settings applied to this environment.") + bicepSettings?: string; + @doc("List of Recipe Pack resource IDs linked to this environment.") recipePacks?: string[]; diff --git a/typespec/Radius.Core/main.tsp b/typespec/Radius.Core/main.tsp index e09ad9da07..fe95d45c8f 100644 --- a/typespec/Radius.Core/main.tsp +++ b/typespec/Radius.Core/main.tsp @@ -10,6 +10,8 @@ import "../radius/v1/resources.tsp"; import "../radius/v1/trackedresource.tsp"; import "./applications.tsp"; import "./environments.tsp"; +import "./terraformSettings.tsp"; +import "./bicepSettings.tsp"; import "./recipePacks.tsp"; using Azure.ResourceManager; diff --git a/typespec/Radius.Core/terraformSettings.tsp b/typespec/Radius.Core/terraformSettings.tsp new file mode 100644 index 0000000000..bc9bf11719 --- /dev/null +++ b/typespec/Radius.Core/terraformSettings.tsp @@ -0,0 +1,170 @@ +/* +Copyright 2023 The Radius Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +import "@typespec/rest"; +import "@typespec/versioning"; +import "@typespec/openapi"; +import "@azure-tools/typespec-autorest"; +import "@azure-tools/typespec-azure-core"; +import "@azure-tools/typespec-azure-resource-manager"; + +import "../radius/v1/ucprootscope.tsp"; +import "../radius/v1/resources.tsp"; +import "../radius/v1/trackedresource.tsp"; + +using Azure.ResourceManager; +using TypeSpec.Http; +using TypeSpec.Rest; +using TypeSpec.Versioning; +using Autorest; +using Azure.Core; +using OpenAPI; + +namespace Radius.Core; + +@doc("Terraform settings resource.") +model TerraformSettingsResource + is TrackedResourceRequired { + @doc("Terraform settings resource name.") + @key("terraformSettingsName") + @path + @segment("terraformSettings") + name: ResourceNameString; +} + +@doc("Terraform settings properties.") +model TerraformSettingsProperties { + @doc("Provisioning state of the asynchronous operation.") + @visibility(Lifecycle.Read) + provisioningState?: ProvisioningState; + + @doc("Terraform CLI configuration equivalent to the terraformrc file.") + terraformrc?: TerraformCliConfiguration; + + @doc("Terraform backend configuration.") + backend?: TerraformBackendConfiguration; + + @doc("Environment variables injected into the Terraform process.") + env?: Record; + + @doc("Logging configuration applied to Terraform executions.") + logging?: TerraformLoggingConfiguration; +} + +@doc("Terraform CLI configuration matching the terraformrc file.") +model TerraformCliConfiguration { + @doc("Provider installation configuration controlling how Terraform installs providers.") + provider_installation?: TerraformProviderInstallationConfiguration; + + @doc("Credentials keyed by registry or module source hostname.") + credentials?: Record; +} + +@doc("Provider installation options for Terraform.") +model TerraformProviderInstallationConfiguration { + @doc("Network mirror configuration used to download providers.") + network_mirror?: TerraformNetworkMirrorConfiguration; + + @doc("Direct installation rules controlling when Terraform reaches public registries.") + direct?: TerraformDirectConfiguration; +} + +@doc("Network mirror configuration for Terraform providers.") +model TerraformNetworkMirrorConfiguration { + @doc("Mirror URL used to download providers.") + url: string; + + @doc("Provider addresses included in this mirror.") + include?: string[]; + + @doc("Provider addresses excluded from this mirror.") + exclude?: string[]; +} + +@doc("Direct installation configuration for Terraform providers.") +model TerraformDirectConfiguration { + @doc("Provider addresses included when falling back to direct installation.") + include?: string[]; + + @doc("Provider addresses excluded from direct installation.") + exclude?: string[]; +} + +@doc("Credential configuration for Terraform provider or module sources.") +model TerraformCredentialConfiguration { + @doc("Resource ID of the Radius.Security/secrets entry containing the credential values (for example token).") + secret?: string; +} + +#suppress "@azure-tools/typespec-azure-core/bad-record-type" +@doc("Terraform backend configuration matching the terraform block.") +model TerraformBackendConfiguration extends Record { + @doc("Backend type (for example 'kubernetes').") + type: string; + + @doc("Backend-specific configuration values.") + config?: Record; +} + +@doc("Logging options for Terraform executions.") +model TerraformLoggingConfiguration { + @doc("Terraform log verbosity (maps to TF_LOG).") + level?: TerraformLogLevel; + + @doc("Destination file path for Terraform logs (maps to TF_LOG_PATH).") + path?: string; +} + +@doc("Terraform log verbosity levels.") +enum TerraformLogLevel { + trace: "TRACE", + debug: "DEBUG", + info: "INFO", + warn: "WARN", + error: "ERROR", + fatal: "FATAL", +} + +@armResourceOperations +interface TerraformSettings { + get is ArmResourceRead< + TerraformSettingsResource, + UCPBaseParameters + >; + + createOrUpdate is ArmResourceCreateOrReplaceSync< + TerraformSettingsResource, + UCPBaseParameters + >; + + update is ArmResourcePatchSync< + TerraformSettingsResource, + TerraformSettingsProperties, + UCPBaseParameters + >; + + delete is ArmResourceDeleteSync< + TerraformSettingsResource, + UCPBaseParameters + >; + + listByScope is ArmResourceListByParent< + TerraformSettingsResource, + UCPBaseParameters, + "Scope", + "Scope" + >; +}