From 61db9d4f7a377c359ed63b31c5866b90eebdc0b9 Mon Sep 17 00:00:00 2001 From: JT <100274846+jiaweitao001@users.noreply.github.com> Date: Tue, 30 Aug 2022 09:31:12 +0800 Subject: [PATCH] New Resource: `azurerm_spring_cloud_connection` and `azurerm_app_service_connection` (#16907) New Resource: `azurerm_spring_cloud_connection` and `azurerm_app_service_connection` --- .teamcity/components/generated/services.kt | 1 + internal/clients/client.go | 3 + internal/provider/services.go | 2 + .../serviceconnector/client/client.go | 25 ++ internal/services/serviceconnector/helper.go | 277 +++++++++++++++++ .../services/serviceconnector/registration.go | 28 ++ .../service_connector_app_service_resource.go | 277 +++++++++++++++++ ...ice_connector_app_service_resource_test.go | 220 ++++++++++++++ ...service_connector_spring_cloud_resource.go | 279 ++++++++++++++++++ ...ce_connector_spring_cloud_resource_test.go | 238 +++++++++++++++ .../servicelinker/2022-05-01/links/README.md | 77 +++++ .../servicelinker/2022-05-01/links/client.go | 18 ++ .../2022-05-01/links/constants.go | 244 +++++++++++++++ .../2022-05-01/links/id_scopedlinker.go | 110 +++++++ .../links/method_linkerdelete_autorest.go | 78 +++++ ...ethod_linkerlistconfigurations_autorest.go | 69 +++++ .../links/method_linkerupdate_autorest.go | 79 +++++ .../links/method_linkervalidate_autorest.go | 78 +++++ .../2022-05-01/links/model_authinfobase.go | 80 +++++ .../links/model_azurekeyvaultproperties.go | 41 +++ .../2022-05-01/links/model_azureresource.go | 68 +++++ .../model_azureresourcepropertiesbase.go | 48 +++ .../links/model_confluentbootstrapserver.go | 41 +++ .../links/model_confluentschemaregistry.go | 41 +++ ...model_keyvaultsecretreferencesecretinfo.go | 42 +++ .../model_keyvaultsecreturisecretinfo.go | 41 +++ .../2022-05-01/links/model_linkerpatch.go | 8 + .../links/model_linkerproperties.go | 57 ++++ .../2022-05-01/links/model_linkerresource.go | 16 + .../2022-05-01/links/model_secretauthinfo.go | 68 +++++ .../2022-05-01/links/model_secretinfobase.go | 64 ++++ .../2022-05-01/links/model_secretstore.go | 8 + ...del_serviceprincipalcertificateauthinfo.go | 43 +++ .../model_serviceprincipalsecretauthinfo.go | 43 +++ .../links/model_sourceconfiguration.go | 9 + .../links/model_sourceconfigurationresult.go | 8 + .../model_systemassignedidentityauthinfo.go | 40 +++ .../links/model_targetservicebase.go | 64 ++++ .../model_userassignedidentityauthinfo.go | 42 +++ .../links/model_validateoperationresult.go | 10 + .../2022-05-01/links/model_validateresult.go | 45 +++ .../links/model_validationresultitem.go | 12 + .../2022-05-01/links/model_valuesecretinfo.go | 41 +++ .../2022-05-01/links/model_vnetsolution.go | 8 + .../servicelinker/2022-05-01/links/version.go | 12 + .../2022-05-01/servicelinker/README.md | 70 +++++ .../2022-05-01/servicelinker/client.go | 18 ++ .../2022-05-01/servicelinker/constants.go | 213 +++++++++++++ .../servicelinker/id_scopedlinker.go | 110 +++++++ .../method_linkercreateorupdate_autorest.go | 79 +++++ .../method_linkerget_autorest.go | 68 +++++ .../method_linkerlist_autorest.go | 187 ++++++++++++ .../servicelinker/model_authinfobase.go | 80 +++++ .../model_azurekeyvaultproperties.go | 41 +++ .../servicelinker/model_azureresource.go | 68 +++++ .../model_azureresourcepropertiesbase.go | 48 +++ .../model_confluentbootstrapserver.go | 41 +++ .../model_confluentschemaregistry.go | 41 +++ ...model_keyvaultsecretreferencesecretinfo.go | 42 +++ .../model_keyvaultsecreturisecretinfo.go | 41 +++ .../servicelinker/model_linkerproperties.go | 57 ++++ .../servicelinker/model_linkerresource.go | 16 + .../servicelinker/model_secretauthinfo.go | 68 +++++ .../servicelinker/model_secretinfobase.go | 64 ++++ .../servicelinker/model_secretstore.go | 8 + ...del_serviceprincipalcertificateauthinfo.go | 43 +++ .../model_serviceprincipalsecretauthinfo.go | 43 +++ .../model_systemassignedidentityauthinfo.go | 40 +++ .../servicelinker/model_targetservicebase.go | 64 ++++ .../model_userassignedidentityauthinfo.go | 42 +++ .../servicelinker/model_valuesecretinfo.go | 41 +++ .../servicelinker/model_vnetsolution.go | 8 + .../2022-05-01/servicelinker/predicates.go | 24 ++ .../2022-05-01/servicelinker/version.go | 12 + vendor/modules.txt | 2 + ...ervice_connector_app_service.html.markdown | 133 +++++++++ ...rvice_connector_spring_cloud.html.markdown | 138 +++++++++ 77 files changed, 5053 insertions(+) create mode 100644 internal/services/serviceconnector/client/client.go create mode 100644 internal/services/serviceconnector/helper.go create mode 100644 internal/services/serviceconnector/registration.go create mode 100644 internal/services/serviceconnector/service_connector_app_service_resource.go create mode 100644 internal/services/serviceconnector/service_connector_app_service_resource_test.go create mode 100644 internal/services/serviceconnector/service_connector_spring_cloud_resource.go create mode 100644 internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/id_scopedlinker.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkerdelete_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkerlistconfigurations_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkerupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkervalidate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_authinfobase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_azurekeyvaultproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_azureresource.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_azureresourcepropertiesbase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_confluentbootstrapserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_confluentschemaregistry.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_keyvaultsecretreferencesecretinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_keyvaultsecreturisecretinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_linkerpatch.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_linkerproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_linkerresource.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_secretauthinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_secretinfobase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_secretstore.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_serviceprincipalcertificateauthinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_serviceprincipalsecretauthinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_sourceconfiguration.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_sourceconfigurationresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_systemassignedidentityauthinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_targetservicebase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_userassignedidentityauthinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_validateoperationresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_validateresult.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_validationresultitem.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_valuesecretinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_vnetsolution.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/version.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/README.md create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/client.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/constants.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/id_scopedlinker.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/method_linkercreateorupdate_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/method_linkerget_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/method_linkerlist_autorest.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_authinfobase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_azurekeyvaultproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_azureresource.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_azureresourcepropertiesbase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_confluentbootstrapserver.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_confluentschemaregistry.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_keyvaultsecretreferencesecretinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_keyvaultsecreturisecretinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_linkerproperties.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_linkerresource.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_secretauthinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_secretinfobase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_secretstore.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_serviceprincipalcertificateauthinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_serviceprincipalsecretauthinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_systemassignedidentityauthinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_targetservicebase.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_userassignedidentityauthinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_valuesecretinfo.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_vnetsolution.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/predicates.go create mode 100644 vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/version.go create mode 100644 website/docs/r/service_connector_app_service.html.markdown create mode 100644 website/docs/r/service_connector_spring_cloud.html.markdown diff --git a/.teamcity/components/generated/services.kt b/.teamcity/components/generated/services.kt index ad59ec150a6e..5bfbe77a004e 100644 --- a/.teamcity/components/generated/services.kt +++ b/.teamcity/components/generated/services.kt @@ -95,6 +95,7 @@ var services = mapOf( "servicefabric" to "Service Fabric", "servicefabricmanaged" to "Service Fabric Managed Clusters", "servicebus" to "ServiceBus", + "serviceconnector" to "ServiceConnector", "signalr" to "SignalR", "springcloud" to "Spring Cloud", "storage" to "Storage", diff --git a/internal/clients/client.go b/internal/clients/client.go index cbe916417156..966279125650 100644 --- a/internal/clients/client.go +++ b/internal/clients/client.go @@ -99,6 +99,7 @@ import ( securityCenter "github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter/client" sentinel "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel/client" serviceBus "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus/client" + serviceConnector "github.com/hashicorp/terraform-provider-azurerm/internal/services/serviceconnector/client" serviceFabric "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric/client" serviceFabricManaged "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged/client" signalr "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr/client" @@ -213,6 +214,7 @@ type Client struct { SecurityCenter *securityCenter.Client Sentinel *sentinel.Client ServiceBus *serviceBus.Client + ServiceConnector *serviceConnector.Client ServiceFabric *serviceFabric.Client ServiceFabricManaged *serviceFabricManaged.Client SignalR *signalr.Client @@ -329,6 +331,7 @@ func (client *Client) Build(ctx context.Context, o *common.ClientOptions) error client.SecurityCenter = securityCenter.NewClient(o) client.Sentinel = sentinel.NewClient(o) client.ServiceBus = serviceBus.NewClient(o) + client.ServiceConnector = serviceConnector.NewClient(o) client.ServiceFabric = serviceFabric.NewClient(o) client.ServiceFabricManaged = serviceFabricManaged.NewClient(o) client.SignalR = signalr.NewClient(o) diff --git a/internal/provider/services.go b/internal/provider/services.go index c3e5b13ac22c..f7ee9dad9b59 100644 --- a/internal/provider/services.go +++ b/internal/provider/services.go @@ -94,6 +94,7 @@ import ( "github.com/hashicorp/terraform-provider-azurerm/internal/services/securitycenter" "github.com/hashicorp/terraform-provider-azurerm/internal/services/sentinel" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicebus" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/serviceconnector" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabric" "github.com/hashicorp/terraform-provider-azurerm/internal/services/servicefabricmanaged" "github.com/hashicorp/terraform-provider-azurerm/internal/services/signalr" @@ -139,6 +140,7 @@ func SupportedTypedServices() []sdk.TypedServiceRegistration { recoveryservices.Registration{}, resource.Registration{}, sentinel.Registration{}, + serviceconnector.Registration{}, servicefabricmanaged.Registration{}, streamanalytics.Registration{}, web.Registration{}, diff --git a/internal/services/serviceconnector/client/client.go b/internal/services/serviceconnector/client/client.go new file mode 100644 index 000000000000..956129abf0e6 --- /dev/null +++ b/internal/services/serviceconnector/client/client.go @@ -0,0 +1,25 @@ +package client + +import ( + "github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker" + "github.com/hashicorp/terraform-provider-azurerm/internal/common" +) + +type Client struct { + ServiceLinkerClient *servicelinker.ServicelinkerClient + LinksClient *links.LinksClient +} + +func NewClient(o *common.ClientOptions) *Client { + serviceLinkerClient := servicelinker.NewServicelinkerClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&serviceLinkerClient.Client, o.ResourceManagerAuthorizer) + + linksClient := links.NewLinksClientWithBaseURI(o.ResourceManagerEndpoint) + o.ConfigureClient(&linksClient.Client, o.ResourceManagerAuthorizer) + + return &Client{ + ServiceLinkerClient: &serviceLinkerClient, + LinksClient: &linksClient, + } +} diff --git a/internal/services/serviceconnector/helper.go b/internal/services/serviceconnector/helper.go new file mode 100644 index 000000000000..7446575c7696 --- /dev/null +++ b/internal/services/serviceconnector/helper.go @@ -0,0 +1,277 @@ +package serviceconnector + +import ( + "fmt" + + "github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type AuthInfoModel struct { + Type string `tfschema:"type"` + Name string `tfschema:"name"` + Secret string `tfschema:"secret"` + ClientId string `tfschema:"client_id"` + PrincipalId string `tfschema:"principal_id"` + SubscriptionId string `tfschema:"subscription_id"` + Certificate string `tfschema:"certificate"` +} + +func authInfoSchema() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Required: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*schema.Schema{ + "type": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringInSlice([]string{ + string(servicelinker.AuthTypeSecret), + string(servicelinker.AuthTypeServicePrincipalSecret), + string(servicelinker.AuthTypeServicePrincipalCertificate), + string(servicelinker.AuthTypeSystemAssignedIdentity), + string(servicelinker.AuthTypeUserAssignedIdentity), + }, false), + }, + + "name": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "secret": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "client_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "subscription_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "principal_id": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "certificate": { + Type: pluginsdk.TypeString, + Optional: true, + Sensitive: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + } +} + +func expandServiceConnectorAuthInfo(input []AuthInfoModel) (servicelinker.AuthInfoBase, error) { + if len(input) == 0 { + return nil, fmt.Errorf("authentication should be defined") + } + v := input[0] + + authType := servicelinker.AuthType(v.Type) + name := v.Name + secret := v.Secret + clientId := v.ClientId + subscriptionId := v.SubscriptionId + principalId := v.PrincipalId + certificate := v.Certificate + + switch authType { + case servicelinker.AuthTypeSecret: + if clientId != "" { + return nil, fmt.Errorf("`client_id` cannot be set when `type` is set to `Secret`") + } + if subscriptionId != "" { + return nil, fmt.Errorf("`subscription_id` cannot be set when `type` is set to `Secret`") + } + if principalId != "" { + return nil, fmt.Errorf("`principal_id` cannot be set when `type` is set to `Secret`") + } + if certificate != "" { + return nil, fmt.Errorf("`certificate` cannot be set when `type` is set to `Secret`") + } + if name != "" && secret == "" { + return nil, fmt.Errorf("`name` cannot be set when `secret` is empty") + } + if name == "" && secret != "" { + return nil, fmt.Errorf("`secret` cannot be set when `name` is empty") + } + return servicelinker.SecretAuthInfo{ + Name: utils.String(name), + SecretInfo: secret, + }, nil + + case servicelinker.AuthTypeSystemAssignedIdentity: + if name != "" || secret != "" || clientId != "" || subscriptionId != "" || principalId != "" || certificate != "" { + return nil, fmt.Errorf("no other parameters should be set when `type` is set to `SystemIdentity`") + } + return servicelinker.SystemAssignedIdentityAuthInfo{}, nil + + case servicelinker.AuthTypeServicePrincipalSecret: + if clientId == "" { + return nil, fmt.Errorf("`client_id` must be specified when `type` is set to `ServicePrincipal`") + } + if principalId == "" { + return nil, fmt.Errorf("`principal_id` must be specified when `type` is set to `ServicePrincipal`") + } + if secret == "" { + return nil, fmt.Errorf("`secret` must be specified when `type` is set to `ServicePrincipal`") + } + if subscriptionId != "" { + return nil, fmt.Errorf("`subscription_id` cannot be set when `type` is set to `ServicePrincipal`") + } + if name != "" { + return nil, fmt.Errorf("`name` cannot be set when `type` is set to `ServicePrincipal`") + } + if certificate != "" { + return nil, fmt.Errorf("`certificate` cannot be set when `type` is set to `ServicePrincipal`") + } + return servicelinker.ServicePrincipalSecretAuthInfo{ + ClientId: clientId, + PrincipalId: principalId, + Secret: secret, + }, nil + + case servicelinker.AuthTypeServicePrincipalCertificate: + if clientId == "" { + return nil, fmt.Errorf("`client_id` must be specified when `type` is set to `ServicePrincipalCertificate`") + } + if principalId == "" { + return nil, fmt.Errorf("`principal_id` must be specified when `type` is set to `ServicePrincipalCertificate`") + } + if certificate == "" { + return nil, fmt.Errorf("`certificate` must be specified when `type` is set to `ServicePrincipalCertificate`") + } + if subscriptionId != "" { + return nil, fmt.Errorf("`subscription_id` cannot be set when `type` is set to `ServicePrincipalCertificate`") + } + if name != "" { + return nil, fmt.Errorf("`name` cannot be set when `type` is set to `ServicePrincipalCertificate`") + } + if secret != "" { + return nil, fmt.Errorf("`secret` cannot be set when `type` is set to `ServicePrincipalCertificate`") + } + return servicelinker.ServicePrincipalCertificateAuthInfo{ + Certificate: certificate, + ClientId: clientId, + PrincipalId: principalId, + }, nil + + case servicelinker.AuthTypeUserAssignedIdentity: + if principalId != "" { + return nil, fmt.Errorf("`principal_id` cannot be set when `type` is set to `UserIdentity`") + } + if certificate != "" { + return nil, fmt.Errorf("`certificate` cannot be set when `type` is set to `UserIdentity`") + } + if name != "" { + return nil, fmt.Errorf("`name` cannot be set when `type` is set to `UserIdentity`") + } + if secret != "" { + return nil, fmt.Errorf("`secret` cannot be set when `type` is set to `UserIdentity`") + } + if clientId == "" && subscriptionId != "" { + return nil, fmt.Errorf("`subscription_id` cannot be set when `client_id` is empty") + } + if clientId != "" && subscriptionId == "" { + return nil, fmt.Errorf("`client_id` cannot be set when `subscription_id` is empty") + } + return servicelinker.UserAssignedIdentityAuthInfo{ + ClientId: utils.String(clientId), + SubscriptionId: utils.String(subscriptionId), + }, nil + } + + return nil, fmt.Errorf("unsupported authentication type %q", authType) +} + +func flattenServiceConnectorAuthInfo(input servicelinker.AuthInfoBase) []AuthInfoModel { + var authType string + var name string + var secret string + var clientId string + var principalId string + var subscriptionId string + var certificate string + + if value, ok := input.(servicelinker.SecretAuthInfo); ok { + authType = string(servicelinker.AuthTypeSecret) + if value.Name != nil { + name = *value.Name + } + secret = value.SecretInfo.(string) + } + + if _, ok := input.(servicelinker.SystemAssignedIdentityAuthInfo); ok { + authType = string(servicelinker.AuthTypeSystemAssignedIdentity) + } + + if value, ok := input.(servicelinker.UserAssignedIdentityAuthInfo); ok { + authType = string(servicelinker.AuthTypeUserAssignedIdentity) + if value.ClientId != nil { + clientId = *value.ClientId + } + if value.SubscriptionId != nil { + subscriptionId = *value.SubscriptionId + } + } + + if value, ok := input.(servicelinker.ServicePrincipalSecretAuthInfo); ok { + authType = string(servicelinker.AuthTypeServicePrincipalSecret) + clientId = value.ClientId + principalId = value.PrincipalId + secret = value.Secret + } + + if value, ok := input.(servicelinker.ServicePrincipalCertificateAuthInfo); ok { + authType = string(servicelinker.AuthTypeServicePrincipalCertificate) + certificate = value.Certificate + clientId = value.ClientId + principalId = value.PrincipalId + } + + return []AuthInfoModel{ + { + Type: authType, + Name: name, + Secret: secret, + ClientId: clientId, + PrincipalId: principalId, + SubscriptionId: subscriptionId, + Certificate: certificate, + }, + } +} + +//TODO: Only support Azure resource for now. Will include ConfluentBootstrapServer and ConfluentSchemaRegistry in the future. +func flattenTargetService(input servicelinker.TargetServiceBase) string { + var targetServiceId string + + if value, ok := input.(servicelinker.AzureResource); ok { + if value.Id != nil { + targetServiceId = *value.Id + } + } + + return targetServiceId +} diff --git a/internal/services/serviceconnector/registration.go b/internal/services/serviceconnector/registration.go new file mode 100644 index 000000000000..77cc32a6e32b --- /dev/null +++ b/internal/services/serviceconnector/registration.go @@ -0,0 +1,28 @@ +package serviceconnector + +import ( + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" +) + +type Registration struct{} + +var _ sdk.TypedServiceRegistration = Registration{} + +func (r Registration) WebsiteCategories() []string { + return []string{} +} + +func (r Registration) DataSources() []sdk.DataSource { + return []sdk.DataSource{} +} + +func (r Registration) Resources() []sdk.Resource { + return []sdk.Resource{ + AppServiceConnectorResource{}, + SpringCloudConnectorResource{}, + } +} + +func (r Registration) Name() string { + return "ServiceConnector" +} diff --git a/internal/services/serviceconnector/service_connector_app_service_resource.go b/internal/services/serviceconnector/service_connector_app_service_resource.go new file mode 100644 index 000000000000..5d46dc91e194 --- /dev/null +++ b/internal/services/serviceconnector/service_connector_app_service_resource.go @@ -0,0 +1,277 @@ +package serviceconnector + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/web/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type AppServiceConnectorResource struct{} + +type AppServiceConnectorResourceModel struct { + Name string `tfschema:"name"` + AppServiceId string `tfschema:"app_service_id"` + TargetResourceId string `tfschema:"target_resource_id"` + ClientType string `tfschema:"client_type"` + AuthInfo []AuthInfoModel `tfschema:"authentication"` + VnetSolution string `tfschema:"vnet_solution"` +} + +func (r AppServiceConnectorResource) Arguments() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "app_service_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.AppServiceID, + }, + + "target_resource_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: azure.ValidateResourceID, + }, + + "client_type": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(servicelinker.ClientTypeNone), + ValidateFunc: validation.StringInSlice([]string{ + string(servicelinker.ClientTypeNone), + string(servicelinker.ClientTypeDotnet), + string(servicelinker.ClientTypeJava), + string(servicelinker.ClientTypePython), + string(servicelinker.ClientTypeGo), + string(servicelinker.ClientTypePhp), + string(servicelinker.ClientTypeRuby), + string(servicelinker.ClientTypeDjango), + string(servicelinker.ClientTypeNodejs), + string(servicelinker.ClientTypeSpringBoot), + }, false), + }, + + "vnet_solution": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(servicelinker.VNetSolutionTypePrivateLink), + ValidateFunc: validation.StringInSlice([]string{ + string(servicelinker.VNetSolutionTypeServiceEndpoint), + string(servicelinker.VNetSolutionTypePrivateLink), + }, false), + }, + + "authentication": authInfoSchema(), + } +} + +func (r AppServiceConnectorResource) Attributes() map[string]*schema.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r AppServiceConnectorResource) ModelObject() interface{} { + return &AppServiceConnectorResourceModel{} +} + +func (r AppServiceConnectorResource) ResourceType() string { + return "azurerm_app_service_connection" +} + +func (r AppServiceConnectorResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model AppServiceConnectorResourceModel + if err := metadata.Decode(&model); err != nil { + return err + } + + client := metadata.Client.ServiceConnector.ServiceLinkerClient + + id := servicelinker.NewScopedLinkerID(model.AppServiceId, model.Name) + existing, err := client.LinkerGet(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + authInfo, err := expandServiceConnectorAuthInfo(model.AuthInfo) + if err != nil { + return fmt.Errorf("expanding `authentication`: %+v", err) + } + + serviceConnectorProperties := servicelinker.LinkerProperties{ + AuthInfo: authInfo, + TargetService: servicelinker.AzureResource{ + Id: &model.TargetResourceId, + }, + } + + if model.ClientType != "" { + clientType := servicelinker.ClientType(model.ClientType) + serviceConnectorProperties.ClientType = &clientType + } + + if model.VnetSolution != "" { + vNetSolutionType := servicelinker.VNetSolutionType(model.VnetSolution) + vNetSolution := servicelinker.VNetSolution{ + Type: &vNetSolutionType, + } + serviceConnectorProperties.VNetSolution = &vNetSolution + } + + props := servicelinker.LinkerResource{ + Id: utils.String(id.ID()), + Name: utils.String(model.Name), + Properties: serviceConnectorProperties, + } + + if _, err = client.LinkerCreateOrUpdate(ctx, id, props); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r AppServiceConnectorResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ServiceConnector.ServiceLinkerClient + id, err := servicelinker.ParseScopedLinkerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.LinkerGet(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("reading %s: %+v", *id, err) + } + + if model := resp.Model; model != nil { + props := model.Properties + if props.AuthInfo == nil || props.TargetService == nil { + return nil + } + + state := AppServiceConnectorResourceModel{ + Name: id.LinkerName, + AppServiceId: id.ResourceUri, + TargetResourceId: flattenTargetService(props.TargetService), + AuthInfo: flattenServiceConnectorAuthInfo(props.AuthInfo), + } + + if props.ClientType != nil { + state.ClientType = string(*props.ClientType) + } + + if props.VNetSolution != nil && props.VNetSolution.Type != nil { + state.VnetSolution = string(*props.VNetSolution.Type) + } + + return metadata.Encode(&state) + } + return nil + }, + } +} + +func (r AppServiceConnectorResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ServiceConnector.LinksClient + id, err := links.ParseScopedLinkerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("deleting %s", *id) + + if resp, err := client.LinkerDelete(ctx, *id); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + } + return nil + }, + } +} + +func (r AppServiceConnectorResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ServiceConnector.LinksClient + id, err := links.ParseScopedLinkerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var state AppServiceConnectorResourceModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding %+v", err) + } + + linkerProps := links.LinkerProperties{} + d := metadata.ResourceData + + if d.HasChange("client_type") { + clientType := links.ClientType(state.ClientType) + linkerProps.ClientType = &clientType + } + + if d.HasChange("vnet_solution") { + vnetSolutionType := links.VNetSolutionType(state.VnetSolution) + vnetSolution := links.VNetSolution{ + Type: &vnetSolutionType, + } + linkerProps.VNetSolution = &vnetSolution + } + + if d.HasChange("authentication") { + linkerProps.AuthInfo = state.AuthInfo + } + + props := links.LinkerPatch{ + Properties: &linkerProps, + } + + if _, err := client.LinkerUpdate(ctx, *id, props); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + return nil + }, + } +} + +func (r AppServiceConnectorResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return servicelinker.ValidateScopedLinkerID +} diff --git a/internal/services/serviceconnector/service_connector_app_service_resource_test.go b/internal/services/serviceconnector/service_connector_app_service_resource_test.go new file mode 100644 index 000000000000..b8f33d838bd7 --- /dev/null +++ b/internal/services/serviceconnector/service_connector_app_service_resource_test.go @@ -0,0 +1,220 @@ +package serviceconnector_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ServiceConnectorAppServiceResource struct{} + +func (r ServiceConnectorAppServiceResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := servicelinker.ParseScopedLinkerID(state.ID) + if err != nil { + return nil, err + } + + resp, err := client.ServiceConnector.ServiceLinkerClient.LinkerGet(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + return utils.Bool(true), nil +} + +func TestAccServiceConnectorAppServiceCosmosdb_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_app_service_connection", "test") + r := ServiceConnectorAppServiceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.cosmosdbBasic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccServiceConnectorAppServiceCosmosdb_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_app_service_connection", "test") + r := ServiceConnectorAppServiceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.cosmosdbBasic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + { + Config: r.cosmosdbUpdate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccServiceConnectorAppService_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_app_service_connection", "test") + r := ServiceConnectorAppServiceResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r ServiceConnectorAppServiceResource) cosmosdbBasic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_app_service_connection" "test" { + name = "acctestserviceconnector%[3]d" + app_service_id = azurerm_linux_web_app.test.id + target_resource_id = azurerm_cosmosdb_sql_database.test.id + authentication { + type = "systemAssignedIdentity" + } +} +`, template, data.RandomString, data.RandomInteger) +} + +func (r ServiceConnectorAppServiceResource) cosmosdbUpdate(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_cosmosdb_sql_database" "update" { + name = "cosmos-sql-db-update" + resource_group_name = azurerm_cosmosdb_account.test.resource_group_name + account_name = azurerm_cosmosdb_account.test.name + throughput = 400 +} + +resource "azurerm_cosmosdb_sql_container" "update" { + name = "test-containerupdate%[2]s" + resource_group_name = azurerm_cosmosdb_account.test.resource_group_name + account_name = azurerm_cosmosdb_account.test.name + database_name = azurerm_cosmosdb_sql_database.update.name + partition_key_path = "/definitionupdate" +} + +resource "azurerm_service_plan" "update" { + location = azurerm_resource_group.test.location + name = "testserviceplanupdate%[2]s" + resource_group_name = azurerm_resource_group.test.name + sku_name = "P1v2" + os_type = "Linux" +} + +resource "azurerm_app_service_connection" "test" { + name = "acctestserviceconnector%[3]d" + app_service_id = azurerm_linux_web_app.test.id + target_resource_id = azurerm_cosmosdb_sql_database.update.id + authentication { + type = "systemAssignedIdentity" + } +} +`, template, data.RandomString, data.RandomInteger) +} + +func (r ServiceConnectorAppServiceResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_app_service_connection" "test" { + name = "acctestserviceconnector%[2]d" + app_service_id = azurerm_linux_web_app.test.id + target_resource_id = azurerm_cosmosdb_sql_database.test.id + client_type = "java" + vnet_solution = "privateLink" + authentication { + type = "systemAssignedIdentity" + } +} +`, template, data.RandomInteger) +} + +func (r ServiceConnectorAppServiceResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_cosmosdb_account" "test" { + name = "acctestacc%[3]s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + offer_type = "Standard" + kind = "GlobalDocumentDB" + + consistency_policy { + consistency_level = "BoundedStaleness" + max_interval_in_seconds = 10 + max_staleness_prefix = 200 + } + + geo_location { + location = azurerm_resource_group.test.location + failover_priority = 0 + } +} + +resource "azurerm_cosmosdb_sql_database" "test" { + name = "cosmos-sql-db" + resource_group_name = azurerm_cosmosdb_account.test.resource_group_name + account_name = azurerm_cosmosdb_account.test.name + throughput = 400 +} + +resource "azurerm_cosmosdb_sql_container" "test" { + name = "test-container%[3]s" + resource_group_name = azurerm_cosmosdb_account.test.resource_group_name + account_name = azurerm_cosmosdb_account.test.name + database_name = azurerm_cosmosdb_sql_database.test.name + partition_key_path = "/definition" +} + +resource "azurerm_service_plan" "test" { + location = azurerm_resource_group.test.location + name = "testserviceplan%[3]s" + resource_group_name = azurerm_resource_group.test.name + sku_name = "P1v2" + os_type = "Linux" +} + +resource "azurerm_linux_web_app" "test" { + location = azurerm_resource_group.test.location + name = "linuxwebapp%[3]s" + resource_group_name = azurerm_resource_group.test.name + service_plan_id = azurerm_service_plan.test.id + site_config {} +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString) +} diff --git a/internal/services/serviceconnector/service_connector_spring_cloud_resource.go b/internal/services/serviceconnector/service_connector_spring_cloud_resource.go new file mode 100644 index 000000000000..b3f45ea6981c --- /dev/null +++ b/internal/services/serviceconnector/service_connector_spring_cloud_resource.go @@ -0,0 +1,279 @@ +package serviceconnector + +import ( + "context" + "fmt" + "time" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker" + "github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" + "github.com/hashicorp/terraform-provider-azurerm/helpers/azure" + "github.com/hashicorp/terraform-provider-azurerm/internal/sdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/services/springcloud/validate" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/validation" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type SpringCloudConnectorResource struct{} + +type SpringCloudConnectorResourceModel struct { + Name string `tfschema:"name"` + SpringCloudId string `tfschema:"spring_cloud_id"` + TargetResourceId string `tfschema:"target_resource_id"` + ClientType string `tfschema:"client_type"` + AuthInfo []AuthInfoModel `tfschema:"authentication"` + VnetSolution string `tfschema:"vnet_solution"` +} + +func (r SpringCloudConnectorResource) Arguments() map[string]*schema.Schema { + return map[string]*schema.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "spring_cloud_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validate.SpringCloudDeploymentID, + }, + + "target_resource_id": { + Type: pluginsdk.TypeString, + Required: true, + ForceNew: true, + ValidateFunc: validation.Any( + azure.ValidateResourceID, + ), + }, + + "client_type": { + Type: pluginsdk.TypeString, + Optional: true, + Default: string(servicelinker.ClientTypeNone), + ValidateFunc: validation.StringInSlice([]string{ + string(servicelinker.ClientTypeNone), + string(servicelinker.ClientTypeDotnet), + string(servicelinker.ClientTypeJava), + string(servicelinker.ClientTypePython), + string(servicelinker.ClientTypeGo), + string(servicelinker.ClientTypePhp), + string(servicelinker.ClientTypeRuby), + string(servicelinker.ClientTypeDjango), + string(servicelinker.ClientTypeNodejs), + string(servicelinker.ClientTypeSpringBoot), + }, false), + }, + + "vnet_solution": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringInSlice([]string{ + string(servicelinker.VNetSolutionTypeServiceEndpoint), + string(servicelinker.VNetSolutionTypePrivateLink), + }, false), + }, + + "authentication": authInfoSchema(), + } +} + +func (r SpringCloudConnectorResource) Attributes() map[string]*schema.Schema { + return map[string]*pluginsdk.Schema{} +} + +func (r SpringCloudConnectorResource) ModelObject() interface{} { + return &SpringCloudConnectorResourceModel{} +} + +func (r SpringCloudConnectorResource) ResourceType() string { + return "azurerm_spring_cloud_connection" +} + +func (r SpringCloudConnectorResource) Create() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + var model SpringCloudConnectorResourceModel + if err := metadata.Decode(&model); err != nil { + return err + } + + client := metadata.Client.ServiceConnector.ServiceLinkerClient + + id := servicelinker.NewScopedLinkerID(model.SpringCloudId, model.Name) + existing, err := client.LinkerGet(ctx, id) + if err != nil && !response.WasNotFound(existing.HttpResponse) { + return fmt.Errorf("checking for presence of existing %s: %+v", id, err) + } + + if !response.WasNotFound(existing.HttpResponse) { + return metadata.ResourceRequiresImport(r.ResourceType(), id) + } + + authInfo, err := expandServiceConnectorAuthInfo(model.AuthInfo) + if err != nil { + return fmt.Errorf("expanding `authInfo`: %+v", err) + } + + serviceConnectorProperties := servicelinker.LinkerProperties{ + AuthInfo: authInfo, + TargetService: servicelinker.AzureResource{ + Id: &model.TargetResourceId, + }, + } + + if model.ClientType != "" { + clientType := servicelinker.ClientType(model.ClientType) + serviceConnectorProperties.ClientType = &clientType + } + + if model.VnetSolution != "" { + vNetSolutionType := servicelinker.VNetSolutionType(model.VnetSolution) + vNetSolution := servicelinker.VNetSolution{ + Type: &vNetSolutionType, + } + serviceConnectorProperties.VNetSolution = &vNetSolution + } + + props := servicelinker.LinkerResource{ + Id: utils.String(id.ID()), + Name: utils.String(model.Name), + Properties: serviceConnectorProperties, + } + + if _, err = client.LinkerCreateOrUpdate(ctx, id, props); err != nil { + return fmt.Errorf("creating %s: %+v", id, err) + } + + metadata.SetID(id) + return nil + }, + } +} + +func (r SpringCloudConnectorResource) Read() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 5 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ServiceConnector.ServiceLinkerClient + id, err := servicelinker.ParseScopedLinkerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + resp, err := client.LinkerGet(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return metadata.MarkAsGone(id) + } + return fmt.Errorf("reading %s: %+v", *id, err) + } + + if model := resp.Model; model != nil { + props := model.Properties + if props.AuthInfo == nil || props.TargetService == nil { + return nil + } + + state := SpringCloudConnectorResourceModel{ + Name: id.LinkerName, + SpringCloudId: id.ResourceUri, + TargetResourceId: flattenTargetService(props.TargetService), + AuthInfo: flattenServiceConnectorAuthInfo(props.AuthInfo), + } + + if props.ClientType != nil { + state.ClientType = string(*props.ClientType) + + } + + if props.VNetSolution != nil && props.VNetSolution.Type != nil { + state.VnetSolution = string(*props.VNetSolution.Type) + } + + return metadata.Encode(&state) + } + return nil + }, + } +} + +func (r SpringCloudConnectorResource) Delete() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ServiceConnector.LinksClient + id, err := links.ParseScopedLinkerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + metadata.Logger.Infof("deleting %s", *id) + + if resp, err := client.LinkerDelete(ctx, *id); err != nil { + if !response.WasNotFound(resp.HttpResponse) { + return fmt.Errorf("deleting %s: %+v", *id, err) + } + } + return nil + }, + } +} + +func (r SpringCloudConnectorResource) Update() sdk.ResourceFunc { + return sdk.ResourceFunc{ + Timeout: 30 * time.Minute, + Func: func(ctx context.Context, metadata sdk.ResourceMetaData) error { + client := metadata.Client.ServiceConnector.LinksClient + id, err := links.ParseScopedLinkerID(metadata.ResourceData.Id()) + if err != nil { + return err + } + + var state SpringCloudConnectorResourceModel + if err := metadata.Decode(&state); err != nil { + return fmt.Errorf("decoding %+v", err) + } + + linkerProps := links.LinkerProperties{} + d := metadata.ResourceData + + if d.HasChange("client_type") { + clientType := links.ClientType(state.ClientType) + linkerProps.ClientType = &clientType + } + + if d.HasChange("vnet_solution") { + vnetSolutionType := links.VNetSolutionType(state.VnetSolution) + vnetSolution := links.VNetSolution{ + Type: &vnetSolutionType, + } + linkerProps.VNetSolution = &vnetSolution + } + + if d.HasChange("authentication") { + linkerProps.AuthInfo = state.AuthInfo + } + + props := links.LinkerPatch{ + Properties: &linkerProps, + } + + if _, err := client.LinkerUpdate(ctx, *id, props); err != nil { + return fmt.Errorf("updating %s: %+v", *id, err) + } + return nil + }, + } +} + +func (r SpringCloudConnectorResource) IDValidationFunc() pluginsdk.SchemaValidateFunc { + return servicelinker.ValidateScopedLinkerID +} diff --git a/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go b/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go new file mode 100644 index 000000000000..b7f3d0d1cd5e --- /dev/null +++ b/internal/services/serviceconnector/service_connector_spring_cloud_resource_test.go @@ -0,0 +1,238 @@ +package serviceconnector_test + +import ( + "context" + "fmt" + "testing" + + "github.com/hashicorp/go-azure-helpers/lang/response" + "github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance" + "github.com/hashicorp/terraform-provider-azurerm/internal/acceptance/check" + "github.com/hashicorp/terraform-provider-azurerm/internal/clients" + "github.com/hashicorp/terraform-provider-azurerm/internal/tf/pluginsdk" + "github.com/hashicorp/terraform-provider-azurerm/utils" +) + +type ServiceConnectorSpringCloudResource struct{} + +func (r ServiceConnectorSpringCloudResource) Exists(ctx context.Context, client *clients.Client, state *pluginsdk.InstanceState) (*bool, error) { + id, err := servicelinker.ParseScopedLinkerID(state.ID) + if err != nil { + return nil, err + } + + resp, err := client.ServiceConnector.ServiceLinkerClient.LinkerGet(ctx, *id) + if err != nil { + if response.WasNotFound(resp.HttpResponse) { + return utils.Bool(false), nil + } + return nil, fmt.Errorf("retrieving %s: %+v", *id, err) + } + return utils.Bool(true), nil +} + +func TestAccServiceConnectorSpringCloudCosmosdb_basic(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_spring_cloud_connection", "test") + r := ServiceConnectorSpringCloudResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.cosmosdbBasic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccServiceConnectorSpringCloudCosmosdb_update(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_spring_cloud_connection", "test") + r := ServiceConnectorSpringCloudResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.cosmosdbBasic(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + { + Config: r.cosmosdbUpdate(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func TestAccServiceConnectorSpringCloud_complete(t *testing.T) { + data := acceptance.BuildTestData(t, "azurerm_spring_cloud_connection", "test") + r := ServiceConnectorSpringCloudResource{} + + data.ResourceTest(t, r, []acceptance.TestStep{ + { + Config: r.complete(data), + Check: acceptance.ComposeTestCheckFunc( + check.That(data.ResourceName).ExistsInAzure(r), + ), + }, + data.ImportStep(), + }) +} + +func (r ServiceConnectorSpringCloudResource) cosmosdbBasic(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_spring_cloud_connection" "test" { + name = "acctestserviceconnector%[3]d" + spring_cloud_id = azurerm_spring_cloud_java_deployment.test.id + target_resource_id = azurerm_cosmosdb_sql_database.test.id + authentication { + type = "systemAssignedIdentity" + } +} +`, template, data.RandomString, data.RandomInteger) +} + +func (r ServiceConnectorSpringCloudResource) cosmosdbUpdate(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_cosmosdb_sql_database" "update" { + name = "cosmos-sql-db-update" + resource_group_name = azurerm_cosmosdb_account.test.resource_group_name + account_name = azurerm_cosmosdb_account.test.name + throughput = 400 +} + +resource "azurerm_cosmosdb_sql_container" "update" { + name = "test-containerupdate%[2]s" + resource_group_name = azurerm_cosmosdb_account.test.resource_group_name + account_name = azurerm_cosmosdb_account.test.name + database_name = azurerm_cosmosdb_sql_database.update.name + partition_key_path = "/definitionupdate" +} + +resource "azurerm_spring_cloud_service" "update" { + name = "updatespringcloud-%[2]s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_spring_cloud_app" "update" { + name = "testspringcloudupdate-%[2]s" + resource_group_name = azurerm_resource_group.test.name + service_name = azurerm_spring_cloud_service.update.name + + identity { + type = "SystemAssigned" + } +} + +resource "azurerm_spring_cloud_java_deployment" "update" { + name = "deploy-%[2]s" + spring_cloud_app_id = azurerm_spring_cloud_app.update.id +} + +resource "azurerm_spring_cloud_connection" "test" { + name = "acctestserviceconnector%[3]d" + spring_cloud_id = azurerm_spring_cloud_java_deployment.update.id + target_resource_id = azurerm_cosmosdb_sql_database.update.id + authentication { + type = "systemAssignedIdentity" + } +} +`, template, data.RandomString, data.RandomInteger) +} + +func (r ServiceConnectorSpringCloudResource) complete(data acceptance.TestData) string { + template := r.template(data) + return fmt.Sprintf(` +%[1]s + +resource "azurerm_spring_cloud_connection" "test" { + name = "acctestserviceconnector%[2]d" + spring_cloud_id = azurerm_spring_cloud_java_deployment.test.id + target_resource_id = azurerm_cosmosdb_sql_database.test.id + client_type = "java" + vnet_solution = "privateLink" + authentication { + type = "systemAssignedIdentity" + } +} +`, template, data.RandomInteger) +} + +func (r ServiceConnectorSpringCloudResource) template(data acceptance.TestData) string { + return fmt.Sprintf(` +provider "azurerm" { + features {} +} + +resource "azurerm_resource_group" "test" { + name = "acctestRG-%[1]d" + location = "%[2]s" +} + +resource "azurerm_cosmosdb_account" "test" { + name = "acctestacc%[3]s" + location = azurerm_resource_group.test.location + resource_group_name = azurerm_resource_group.test.name + offer_type = "Standard" + kind = "GlobalDocumentDB" + + consistency_policy { + consistency_level = "BoundedStaleness" + max_interval_in_seconds = 10 + max_staleness_prefix = 200 + } + + geo_location { + location = azurerm_resource_group.test.location + failover_priority = 0 + } +} + +resource "azurerm_cosmosdb_sql_database" "test" { + name = "cosmos-sql-db" + resource_group_name = azurerm_cosmosdb_account.test.resource_group_name + account_name = azurerm_cosmosdb_account.test.name + throughput = 400 +} + +resource "azurerm_cosmosdb_sql_container" "test" { + name = "test-container%[3]s" + resource_group_name = azurerm_cosmosdb_account.test.resource_group_name + account_name = azurerm_cosmosdb_account.test.name + database_name = azurerm_cosmosdb_sql_database.test.name + partition_key_path = "/definition" +} + +resource "azurerm_spring_cloud_service" "test" { + name = "testspringcloudservice-%[3]s" + resource_group_name = azurerm_resource_group.test.name + location = azurerm_resource_group.test.location +} + +resource "azurerm_spring_cloud_app" "test" { + name = "testspringcloud-%[3]s" + resource_group_name = azurerm_resource_group.test.name + service_name = azurerm_spring_cloud_service.test.name + + identity { + type = "SystemAssigned" + } +} + +resource "azurerm_spring_cloud_java_deployment" "test" { + name = "deploy-%[3]s" + spring_cloud_app_id = azurerm_spring_cloud_app.test.id +} +`, data.RandomInteger, data.Locations.Primary, data.RandomString) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/README.md new file mode 100644 index 000000000000..7026a61d69fe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/README.md @@ -0,0 +1,77 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links` Documentation + +The `links` SDK allows for interaction with the Azure Resource Manager Service `servicelinker` (API Version `2022-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links" +``` + + +### Client Initialization + +```go +client := links.NewLinksClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `LinksClient.LinkerDelete` + +```go +ctx := context.TODO() +id := links.NewScopedLinkerID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "linkerValue") + +if err := client.LinkerDeleteThenPoll(ctx, id); err != nil { + // handle the error +} +``` + + +### Example Usage: `LinksClient.LinkerListConfigurations` + +```go +ctx := context.TODO() +id := links.NewScopedLinkerID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "linkerValue") + +read, err := client.LinkerListConfigurations(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `LinksClient.LinkerUpdate` + +```go +ctx := context.TODO() +id := links.NewScopedLinkerID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "linkerValue") + +payload := links.LinkerPatch{ + // ... +} + + +if err := client.LinkerUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `LinksClient.LinkerValidate` + +```go +ctx := context.TODO() +id := links.NewScopedLinkerID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "linkerValue") + +if err := client.LinkerValidateThenPoll(ctx, id); err != nil { + // handle the error +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/client.go new file mode 100644 index 000000000000..21256038b2fd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/client.go @@ -0,0 +1,18 @@ +package links + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinksClient struct { + Client autorest.Client + baseUri string +} + +func NewLinksClientWithBaseURI(endpoint string) LinksClient { + return LinksClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/constants.go new file mode 100644 index 000000000000..b85a733d3f4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/constants.go @@ -0,0 +1,244 @@ +package links + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthType string + +const ( + AuthTypeSecret AuthType = "secret" + AuthTypeServicePrincipalCertificate AuthType = "servicePrincipalCertificate" + AuthTypeServicePrincipalSecret AuthType = "servicePrincipalSecret" + AuthTypeSystemAssignedIdentity AuthType = "systemAssignedIdentity" + AuthTypeUserAssignedIdentity AuthType = "userAssignedIdentity" +) + +func PossibleValuesForAuthType() []string { + return []string{ + string(AuthTypeSecret), + string(AuthTypeServicePrincipalCertificate), + string(AuthTypeServicePrincipalSecret), + string(AuthTypeSystemAssignedIdentity), + string(AuthTypeUserAssignedIdentity), + } +} + +func parseAuthType(input string) (*AuthType, error) { + vals := map[string]AuthType{ + "secret": AuthTypeSecret, + "serviceprincipalcertificate": AuthTypeServicePrincipalCertificate, + "serviceprincipalsecret": AuthTypeServicePrincipalSecret, + "systemassignedidentity": AuthTypeSystemAssignedIdentity, + "userassignedidentity": AuthTypeUserAssignedIdentity, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AuthType(input) + return &out, nil +} + +type AzureResourceType string + +const ( + AzureResourceTypeKeyVault AzureResourceType = "KeyVault" +) + +func PossibleValuesForAzureResourceType() []string { + return []string{ + string(AzureResourceTypeKeyVault), + } +} + +func parseAzureResourceType(input string) (*AzureResourceType, error) { + vals := map[string]AzureResourceType{ + "keyvault": AzureResourceTypeKeyVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceType(input) + return &out, nil +} + +type ClientType string + +const ( + ClientTypeDjango ClientType = "django" + ClientTypeDotnet ClientType = "dotnet" + ClientTypeGo ClientType = "go" + ClientTypeJava ClientType = "java" + ClientTypeKafkaNegativespringBoot ClientType = "kafka-springBoot" + ClientTypeNodejs ClientType = "nodejs" + ClientTypeNone ClientType = "none" + ClientTypePhp ClientType = "php" + ClientTypePython ClientType = "python" + ClientTypeRuby ClientType = "ruby" + ClientTypeSpringBoot ClientType = "springBoot" +) + +func PossibleValuesForClientType() []string { + return []string{ + string(ClientTypeDjango), + string(ClientTypeDotnet), + string(ClientTypeGo), + string(ClientTypeJava), + string(ClientTypeKafkaNegativespringBoot), + string(ClientTypeNodejs), + string(ClientTypeNone), + string(ClientTypePhp), + string(ClientTypePython), + string(ClientTypeRuby), + string(ClientTypeSpringBoot), + } +} + +func parseClientType(input string) (*ClientType, error) { + vals := map[string]ClientType{ + "django": ClientTypeDjango, + "dotnet": ClientTypeDotnet, + "go": ClientTypeGo, + "java": ClientTypeJava, + "kafka-springboot": ClientTypeKafkaNegativespringBoot, + "nodejs": ClientTypeNodejs, + "none": ClientTypeNone, + "php": ClientTypePhp, + "python": ClientTypePython, + "ruby": ClientTypeRuby, + "springboot": ClientTypeSpringBoot, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClientType(input) + return &out, nil +} + +type SecretType string + +const ( + SecretTypeKeyVaultSecretReference SecretType = "keyVaultSecretReference" + SecretTypeKeyVaultSecretUri SecretType = "keyVaultSecretUri" + SecretTypeRawValue SecretType = "rawValue" +) + +func PossibleValuesForSecretType() []string { + return []string{ + string(SecretTypeKeyVaultSecretReference), + string(SecretTypeKeyVaultSecretUri), + string(SecretTypeRawValue), + } +} + +func parseSecretType(input string) (*SecretType, error) { + vals := map[string]SecretType{ + "keyvaultsecretreference": SecretTypeKeyVaultSecretReference, + "keyvaultsecreturi": SecretTypeKeyVaultSecretUri, + "rawvalue": SecretTypeRawValue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecretType(input) + return &out, nil +} + +type TargetServiceType string + +const ( + TargetServiceTypeAzureResource TargetServiceType = "AzureResource" + TargetServiceTypeConfluentBootstrapServer TargetServiceType = "ConfluentBootstrapServer" + TargetServiceTypeConfluentSchemaRegistry TargetServiceType = "ConfluentSchemaRegistry" +) + +func PossibleValuesForTargetServiceType() []string { + return []string{ + string(TargetServiceTypeAzureResource), + string(TargetServiceTypeConfluentBootstrapServer), + string(TargetServiceTypeConfluentSchemaRegistry), + } +} + +func parseTargetServiceType(input string) (*TargetServiceType, error) { + vals := map[string]TargetServiceType{ + "azureresource": TargetServiceTypeAzureResource, + "confluentbootstrapserver": TargetServiceTypeConfluentBootstrapServer, + "confluentschemaregistry": TargetServiceTypeConfluentSchemaRegistry, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TargetServiceType(input) + return &out, nil +} + +type VNetSolutionType string + +const ( + VNetSolutionTypePrivateLink VNetSolutionType = "privateLink" + VNetSolutionTypeServiceEndpoint VNetSolutionType = "serviceEndpoint" +) + +func PossibleValuesForVNetSolutionType() []string { + return []string{ + string(VNetSolutionTypePrivateLink), + string(VNetSolutionTypeServiceEndpoint), + } +} + +func parseVNetSolutionType(input string) (*VNetSolutionType, error) { + vals := map[string]VNetSolutionType{ + "privatelink": VNetSolutionTypePrivateLink, + "serviceendpoint": VNetSolutionTypeServiceEndpoint, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VNetSolutionType(input) + return &out, nil +} + +type ValidationResultStatus string + +const ( + ValidationResultStatusFailure ValidationResultStatus = "failure" + ValidationResultStatusSuccess ValidationResultStatus = "success" + ValidationResultStatusWarning ValidationResultStatus = "warning" +) + +func PossibleValuesForValidationResultStatus() []string { + return []string{ + string(ValidationResultStatusFailure), + string(ValidationResultStatusSuccess), + string(ValidationResultStatusWarning), + } +} + +func parseValidationResultStatus(input string) (*ValidationResultStatus, error) { + vals := map[string]ValidationResultStatus{ + "failure": ValidationResultStatusFailure, + "success": ValidationResultStatusSuccess, + "warning": ValidationResultStatusWarning, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ValidationResultStatus(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/id_scopedlinker.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/id_scopedlinker.go new file mode 100644 index 000000000000..4ecdaddbb6b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/id_scopedlinker.go @@ -0,0 +1,110 @@ +package links + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScopedLinkerId{} + +// ScopedLinkerId is a struct representing the Resource ID for a Scoped Linker +type ScopedLinkerId struct { + ResourceUri string + LinkerName string +} + +// NewScopedLinkerID returns a new ScopedLinkerId struct +func NewScopedLinkerID(resourceUri string, linkerName string) ScopedLinkerId { + return ScopedLinkerId{ + ResourceUri: resourceUri, + LinkerName: linkerName, + } +} + +// ParseScopedLinkerID parses 'input' into a ScopedLinkerId +func ParseScopedLinkerID(input string) (*ScopedLinkerId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedLinkerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedLinkerId{} + + if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { + return nil, fmt.Errorf("the segment 'resourceUri' was not found in the resource id %q", input) + } + + if id.LinkerName, ok = parsed.Parsed["linkerName"]; !ok { + return nil, fmt.Errorf("the segment 'linkerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScopedLinkerIDInsensitively parses 'input' case-insensitively into a ScopedLinkerId +// note: this method should only be used for API response data and not user input +func ParseScopedLinkerIDInsensitively(input string) (*ScopedLinkerId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedLinkerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedLinkerId{} + + if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { + return nil, fmt.Errorf("the segment 'resourceUri' was not found in the resource id %q", input) + } + + if id.LinkerName, ok = parsed.Parsed["linkerName"]; !ok { + return nil, fmt.Errorf("the segment 'linkerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScopedLinkerID checks that 'input' can be parsed as a Scoped Linker ID +func ValidateScopedLinkerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScopedLinkerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scoped Linker ID +func (id ScopedLinkerId) ID() string { + fmtString := "/%s/providers/Microsoft.ServiceLinker/linkers/%s" + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.ResourceUri, "/"), id.LinkerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scoped Linker ID +func (id ScopedLinkerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.ScopeSegment("resourceUri", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceLinker", "Microsoft.ServiceLinker", "Microsoft.ServiceLinker"), + resourceids.StaticSegment("staticLinkers", "linkers", "linkers"), + resourceids.UserSpecifiedSegment("linkerName", "linkerValue"), + } +} + +// String returns a human-readable description of this Scoped Linker ID +func (id ScopedLinkerId) String() string { + components := []string{ + fmt.Sprintf("Resource Uri: %q", id.ResourceUri), + fmt.Sprintf("Linker Name: %q", id.LinkerName), + } + return fmt.Sprintf("Scoped Linker (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkerdelete_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkerdelete_autorest.go new file mode 100644 index 000000000000..193afe9b793f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkerdelete_autorest.go @@ -0,0 +1,78 @@ +package links + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkerDeleteOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// LinkerDelete ... +func (c LinksClient) LinkerDelete(ctx context.Context, id ScopedLinkerId) (result LinkerDeleteOperationResponse, err error) { + req, err := c.preparerForLinkerDelete(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "links.LinksClient", "LinkerDelete", nil, "Failure preparing request") + return + } + + result, err = c.senderForLinkerDelete(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "links.LinksClient", "LinkerDelete", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// LinkerDeleteThenPoll performs LinkerDelete then polls until it's completed +func (c LinksClient) LinkerDeleteThenPoll(ctx context.Context, id ScopedLinkerId) error { + result, err := c.LinkerDelete(ctx, id) + if err != nil { + return fmt.Errorf("performing LinkerDelete: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after LinkerDelete: %+v", err) + } + + return nil +} + +// preparerForLinkerDelete prepares the LinkerDelete request. +func (c LinksClient) preparerForLinkerDelete(ctx context.Context, id ScopedLinkerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsDelete(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForLinkerDelete sends the LinkerDelete request. The method will close the +// http.Response Body if it receives an error. +func (c LinksClient) senderForLinkerDelete(ctx context.Context, req *http.Request) (future LinkerDeleteOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkerlistconfigurations_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkerlistconfigurations_autorest.go new file mode 100644 index 000000000000..428411d6f2ac --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkerlistconfigurations_autorest.go @@ -0,0 +1,69 @@ +package links + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkerListConfigurationsOperationResponse struct { + HttpResponse *http.Response + Model *SourceConfigurationResult +} + +// LinkerListConfigurations ... +func (c LinksClient) LinkerListConfigurations(ctx context.Context, id ScopedLinkerId) (result LinkerListConfigurationsOperationResponse, err error) { + req, err := c.preparerForLinkerListConfigurations(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "links.LinksClient", "LinkerListConfigurations", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "links.LinksClient", "LinkerListConfigurations", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLinkerListConfigurations(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "links.LinksClient", "LinkerListConfigurations", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForLinkerListConfigurations prepares the LinkerListConfigurations request. +func (c LinksClient) preparerForLinkerListConfigurations(ctx context.Context, id ScopedLinkerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/listConfigurations", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLinkerListConfigurations handles the response to the LinkerListConfigurations request. The method always +// closes the http.Response Body. +func (c LinksClient) responderForLinkerListConfigurations(resp *http.Response) (result LinkerListConfigurationsOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkerupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkerupdate_autorest.go new file mode 100644 index 000000000000..de06323f3300 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkerupdate_autorest.go @@ -0,0 +1,79 @@ +package links + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkerUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// LinkerUpdate ... +func (c LinksClient) LinkerUpdate(ctx context.Context, id ScopedLinkerId, input LinkerPatch) (result LinkerUpdateOperationResponse, err error) { + req, err := c.preparerForLinkerUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "links.LinksClient", "LinkerUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForLinkerUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "links.LinksClient", "LinkerUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// LinkerUpdateThenPoll performs LinkerUpdate then polls until it's completed +func (c LinksClient) LinkerUpdateThenPoll(ctx context.Context, id ScopedLinkerId, input LinkerPatch) error { + result, err := c.LinkerUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing LinkerUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after LinkerUpdate: %+v", err) + } + + return nil +} + +// preparerForLinkerUpdate prepares the LinkerUpdate request. +func (c LinksClient) preparerForLinkerUpdate(ctx context.Context, id ScopedLinkerId, input LinkerPatch) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPatch(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForLinkerUpdate sends the LinkerUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c LinksClient) senderForLinkerUpdate(ctx context.Context, req *http.Request) (future LinkerUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkervalidate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkervalidate_autorest.go new file mode 100644 index 000000000000..749fd09d60dd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/method_linkervalidate_autorest.go @@ -0,0 +1,78 @@ +package links + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkerValidateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// LinkerValidate ... +func (c LinksClient) LinkerValidate(ctx context.Context, id ScopedLinkerId) (result LinkerValidateOperationResponse, err error) { + req, err := c.preparerForLinkerValidate(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "links.LinksClient", "LinkerValidate", nil, "Failure preparing request") + return + } + + result, err = c.senderForLinkerValidate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "links.LinksClient", "LinkerValidate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// LinkerValidateThenPoll performs LinkerValidate then polls until it's completed +func (c LinksClient) LinkerValidateThenPoll(ctx context.Context, id ScopedLinkerId) error { + result, err := c.LinkerValidate(ctx, id) + if err != nil { + return fmt.Errorf("performing LinkerValidate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after LinkerValidate: %+v", err) + } + + return nil +} + +// preparerForLinkerValidate prepares the LinkerValidate request. +func (c LinksClient) preparerForLinkerValidate(ctx context.Context, id ScopedLinkerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPost(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/validateLinker", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForLinkerValidate sends the LinkerValidate request. The method will close the +// http.Response Body if it receives an error. +func (c LinksClient) senderForLinkerValidate(ctx context.Context, req *http.Request) (future LinkerValidateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_authinfobase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_authinfobase.go new file mode 100644 index 000000000000..85f05afb06d4 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_authinfobase.go @@ -0,0 +1,80 @@ +package links + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthInfoBase interface { +} + +func unmarshalAuthInfoBaseImplementation(input []byte) (AuthInfoBase, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling AuthInfoBase into map[string]interface: %+v", err) + } + + value, ok := temp["authType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "secret") { + var out SecretAuthInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SecretAuthInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "servicePrincipalCertificate") { + var out ServicePrincipalCertificateAuthInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServicePrincipalCertificateAuthInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "servicePrincipalSecret") { + var out ServicePrincipalSecretAuthInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServicePrincipalSecretAuthInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "systemAssignedIdentity") { + var out SystemAssignedIdentityAuthInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SystemAssignedIdentityAuthInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "userAssignedIdentity") { + var out UserAssignedIdentityAuthInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into UserAssignedIdentityAuthInfo: %+v", err) + } + return out, nil + } + + type RawAuthInfoBaseImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawAuthInfoBaseImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_azurekeyvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_azurekeyvaultproperties.go new file mode 100644 index 000000000000..e38862e57ae0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_azurekeyvaultproperties.go @@ -0,0 +1,41 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AzureResourcePropertiesBase = AzureKeyVaultProperties{} + +type AzureKeyVaultProperties struct { + ConnectAsKubernetesCsiDriver *bool `json:"connectAsKubernetesCsiDriver,omitempty"` + + // Fields inherited from AzureResourcePropertiesBase +} + +var _ json.Marshaler = AzureKeyVaultProperties{} + +func (s AzureKeyVaultProperties) MarshalJSON() ([]byte, error) { + type wrapper AzureKeyVaultProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureKeyVaultProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureKeyVaultProperties: %+v", err) + } + decoded["type"] = "KeyVault" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureKeyVaultProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_azureresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_azureresource.go new file mode 100644 index 000000000000..56c8436bc7bf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_azureresource.go @@ -0,0 +1,68 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ TargetServiceBase = AzureResource{} + +type AzureResource struct { + Id *string `json:"id,omitempty"` + ResourceProperties AzureResourcePropertiesBase `json:"resourceProperties"` + + // Fields inherited from TargetServiceBase +} + +var _ json.Marshaler = AzureResource{} + +func (s AzureResource) MarshalJSON() ([]byte, error) { + type wrapper AzureResource + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureResource: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureResource: %+v", err) + } + decoded["type"] = "AzureResource" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureResource: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &AzureResource{} + +func (s *AzureResource) UnmarshalJSON(bytes []byte) error { + type alias AzureResource + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AzureResource: %+v", err) + } + + s.Id = decoded.Id + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AzureResource into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["resourceProperties"]; ok { + impl, err := unmarshalAzureResourcePropertiesBaseImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'ResourceProperties' for 'AzureResource': %+v", err) + } + s.ResourceProperties = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_azureresourcepropertiesbase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_azureresourcepropertiesbase.go new file mode 100644 index 000000000000..01e3c5831c39 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_azureresourcepropertiesbase.go @@ -0,0 +1,48 @@ +package links + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourcePropertiesBase interface { +} + +func unmarshalAzureResourcePropertiesBaseImplementation(input []byte) (AzureResourcePropertiesBase, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling AzureResourcePropertiesBase into map[string]interface: %+v", err) + } + + value, ok := temp["type"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "KeyVault") { + var out AzureKeyVaultProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureKeyVaultProperties: %+v", err) + } + return out, nil + } + + type RawAzureResourcePropertiesBaseImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawAzureResourcePropertiesBaseImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_confluentbootstrapserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_confluentbootstrapserver.go new file mode 100644 index 000000000000..e826d3a15694 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_confluentbootstrapserver.go @@ -0,0 +1,41 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ TargetServiceBase = ConfluentBootstrapServer{} + +type ConfluentBootstrapServer struct { + Endpoint *string `json:"endpoint,omitempty"` + + // Fields inherited from TargetServiceBase +} + +var _ json.Marshaler = ConfluentBootstrapServer{} + +func (s ConfluentBootstrapServer) MarshalJSON() ([]byte, error) { + type wrapper ConfluentBootstrapServer + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ConfluentBootstrapServer: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ConfluentBootstrapServer: %+v", err) + } + decoded["type"] = "ConfluentBootstrapServer" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ConfluentBootstrapServer: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_confluentschemaregistry.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_confluentschemaregistry.go new file mode 100644 index 000000000000..3bbf94f748a2 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_confluentschemaregistry.go @@ -0,0 +1,41 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ TargetServiceBase = ConfluentSchemaRegistry{} + +type ConfluentSchemaRegistry struct { + Endpoint *string `json:"endpoint,omitempty"` + + // Fields inherited from TargetServiceBase +} + +var _ json.Marshaler = ConfluentSchemaRegistry{} + +func (s ConfluentSchemaRegistry) MarshalJSON() ([]byte, error) { + type wrapper ConfluentSchemaRegistry + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ConfluentSchemaRegistry: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ConfluentSchemaRegistry: %+v", err) + } + decoded["type"] = "ConfluentSchemaRegistry" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ConfluentSchemaRegistry: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_keyvaultsecretreferencesecretinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_keyvaultsecretreferencesecretinfo.go new file mode 100644 index 000000000000..97fd87695b06 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_keyvaultsecretreferencesecretinfo.go @@ -0,0 +1,42 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SecretInfoBase = KeyVaultSecretReferenceSecretInfo{} + +type KeyVaultSecretReferenceSecretInfo struct { + Name *string `json:"name,omitempty"` + Version *string `json:"version,omitempty"` + + // Fields inherited from SecretInfoBase +} + +var _ json.Marshaler = KeyVaultSecretReferenceSecretInfo{} + +func (s KeyVaultSecretReferenceSecretInfo) MarshalJSON() ([]byte, error) { + type wrapper KeyVaultSecretReferenceSecretInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling KeyVaultSecretReferenceSecretInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling KeyVaultSecretReferenceSecretInfo: %+v", err) + } + decoded["secretType"] = "keyVaultSecretReference" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling KeyVaultSecretReferenceSecretInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_keyvaultsecreturisecretinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_keyvaultsecreturisecretinfo.go new file mode 100644 index 000000000000..abd8430f65b1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_keyvaultsecreturisecretinfo.go @@ -0,0 +1,41 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SecretInfoBase = KeyVaultSecretUriSecretInfo{} + +type KeyVaultSecretUriSecretInfo struct { + Value *string `json:"value,omitempty"` + + // Fields inherited from SecretInfoBase +} + +var _ json.Marshaler = KeyVaultSecretUriSecretInfo{} + +func (s KeyVaultSecretUriSecretInfo) MarshalJSON() ([]byte, error) { + type wrapper KeyVaultSecretUriSecretInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling KeyVaultSecretUriSecretInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling KeyVaultSecretUriSecretInfo: %+v", err) + } + decoded["secretType"] = "keyVaultSecretUri" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling KeyVaultSecretUriSecretInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_linkerpatch.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_linkerpatch.go new file mode 100644 index 000000000000..e27b7cd05b9a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_linkerpatch.go @@ -0,0 +1,8 @@ +package links + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkerPatch struct { + Properties *LinkerProperties `json:"properties,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_linkerproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_linkerproperties.go new file mode 100644 index 000000000000..c3e24a527db3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_linkerproperties.go @@ -0,0 +1,57 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkerProperties struct { + AuthInfo AuthInfoBase `json:"authInfo"` + ClientType *ClientType `json:"clientType,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Scope *string `json:"scope,omitempty"` + SecretStore *SecretStore `json:"secretStore,omitempty"` + TargetService TargetServiceBase `json:"targetService"` + VNetSolution *VNetSolution `json:"vNetSolution,omitempty"` +} + +var _ json.Unmarshaler = &LinkerProperties{} + +func (s *LinkerProperties) UnmarshalJSON(bytes []byte) error { + type alias LinkerProperties + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into LinkerProperties: %+v", err) + } + + s.ClientType = decoded.ClientType + s.ProvisioningState = decoded.ProvisioningState + s.Scope = decoded.Scope + s.SecretStore = decoded.SecretStore + s.VNetSolution = decoded.VNetSolution + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling LinkerProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["authInfo"]; ok { + impl, err := unmarshalAuthInfoBaseImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'AuthInfo' for 'LinkerProperties': %+v", err) + } + s.AuthInfo = impl + } + + if v, ok := temp["targetService"]; ok { + impl, err := unmarshalTargetServiceBaseImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'TargetService' for 'LinkerProperties': %+v", err) + } + s.TargetService = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_linkerresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_linkerresource.go new file mode 100644 index 000000000000..025467e80834 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_linkerresource.go @@ -0,0 +1,16 @@ +package links + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkerResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties LinkerProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_secretauthinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_secretauthinfo.go new file mode 100644 index 000000000000..315fc2b1e9a0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_secretauthinfo.go @@ -0,0 +1,68 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AuthInfoBase = SecretAuthInfo{} + +type SecretAuthInfo struct { + Name *string `json:"name,omitempty"` + SecretInfo SecretInfoBase `json:"secretInfo"` + + // Fields inherited from AuthInfoBase +} + +var _ json.Marshaler = SecretAuthInfo{} + +func (s SecretAuthInfo) MarshalJSON() ([]byte, error) { + type wrapper SecretAuthInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SecretAuthInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SecretAuthInfo: %+v", err) + } + decoded["authType"] = "secret" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SecretAuthInfo: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &SecretAuthInfo{} + +func (s *SecretAuthInfo) UnmarshalJSON(bytes []byte) error { + type alias SecretAuthInfo + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into SecretAuthInfo: %+v", err) + } + + s.Name = decoded.Name + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling SecretAuthInfo into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["secretInfo"]; ok { + impl, err := unmarshalSecretInfoBaseImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'SecretInfo' for 'SecretAuthInfo': %+v", err) + } + s.SecretInfo = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_secretinfobase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_secretinfobase.go new file mode 100644 index 000000000000..5dec1213ebaf --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_secretinfobase.go @@ -0,0 +1,64 @@ +package links + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecretInfoBase interface { +} + +func unmarshalSecretInfoBaseImplementation(input []byte) (SecretInfoBase, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling SecretInfoBase into map[string]interface: %+v", err) + } + + value, ok := temp["secretType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "keyVaultSecretReference") { + var out KeyVaultSecretReferenceSecretInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into KeyVaultSecretReferenceSecretInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "keyVaultSecretUri") { + var out KeyVaultSecretUriSecretInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into KeyVaultSecretUriSecretInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "rawValue") { + var out ValueSecretInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ValueSecretInfo: %+v", err) + } + return out, nil + } + + type RawSecretInfoBaseImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawSecretInfoBaseImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_secretstore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_secretstore.go new file mode 100644 index 000000000000..c90d0f6de061 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_secretstore.go @@ -0,0 +1,8 @@ +package links + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecretStore struct { + KeyVaultId *string `json:"keyVaultId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_serviceprincipalcertificateauthinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_serviceprincipalcertificateauthinfo.go new file mode 100644 index 000000000000..874e93d5febe --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_serviceprincipalcertificateauthinfo.go @@ -0,0 +1,43 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AuthInfoBase = ServicePrincipalCertificateAuthInfo{} + +type ServicePrincipalCertificateAuthInfo struct { + Certificate string `json:"certificate"` + ClientId string `json:"clientId"` + PrincipalId string `json:"principalId"` + + // Fields inherited from AuthInfoBase +} + +var _ json.Marshaler = ServicePrincipalCertificateAuthInfo{} + +func (s ServicePrincipalCertificateAuthInfo) MarshalJSON() ([]byte, error) { + type wrapper ServicePrincipalCertificateAuthInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServicePrincipalCertificateAuthInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServicePrincipalCertificateAuthInfo: %+v", err) + } + decoded["authType"] = "servicePrincipalCertificate" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServicePrincipalCertificateAuthInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_serviceprincipalsecretauthinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_serviceprincipalsecretauthinfo.go new file mode 100644 index 000000000000..68b5a00ccf04 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_serviceprincipalsecretauthinfo.go @@ -0,0 +1,43 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AuthInfoBase = ServicePrincipalSecretAuthInfo{} + +type ServicePrincipalSecretAuthInfo struct { + ClientId string `json:"clientId"` + PrincipalId string `json:"principalId"` + Secret string `json:"secret"` + + // Fields inherited from AuthInfoBase +} + +var _ json.Marshaler = ServicePrincipalSecretAuthInfo{} + +func (s ServicePrincipalSecretAuthInfo) MarshalJSON() ([]byte, error) { + type wrapper ServicePrincipalSecretAuthInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServicePrincipalSecretAuthInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServicePrincipalSecretAuthInfo: %+v", err) + } + decoded["authType"] = "servicePrincipalSecret" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServicePrincipalSecretAuthInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_sourceconfiguration.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_sourceconfiguration.go new file mode 100644 index 000000000000..8d52af4e0ae0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_sourceconfiguration.go @@ -0,0 +1,9 @@ +package links + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SourceConfiguration struct { + Name *string `json:"name,omitempty"` + Value *string `json:"value,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_sourceconfigurationresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_sourceconfigurationresult.go new file mode 100644 index 000000000000..9464f2f5ca08 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_sourceconfigurationresult.go @@ -0,0 +1,8 @@ +package links + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SourceConfigurationResult struct { + Configurations *[]SourceConfiguration `json:"configurations,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_systemassignedidentityauthinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_systemassignedidentityauthinfo.go new file mode 100644 index 000000000000..607b05fdfe4f --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_systemassignedidentityauthinfo.go @@ -0,0 +1,40 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AuthInfoBase = SystemAssignedIdentityAuthInfo{} + +type SystemAssignedIdentityAuthInfo struct { + + // Fields inherited from AuthInfoBase +} + +var _ json.Marshaler = SystemAssignedIdentityAuthInfo{} + +func (s SystemAssignedIdentityAuthInfo) MarshalJSON() ([]byte, error) { + type wrapper SystemAssignedIdentityAuthInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SystemAssignedIdentityAuthInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SystemAssignedIdentityAuthInfo: %+v", err) + } + decoded["authType"] = "systemAssignedIdentity" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SystemAssignedIdentityAuthInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_targetservicebase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_targetservicebase.go new file mode 100644 index 000000000000..5ba50d4ad0b5 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_targetservicebase.go @@ -0,0 +1,64 @@ +package links + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TargetServiceBase interface { +} + +func unmarshalTargetServiceBaseImplementation(input []byte) (TargetServiceBase, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling TargetServiceBase into map[string]interface: %+v", err) + } + + value, ok := temp["type"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "AzureResource") { + var out AzureResource + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureResource: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ConfluentBootstrapServer") { + var out ConfluentBootstrapServer + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ConfluentBootstrapServer: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ConfluentSchemaRegistry") { + var out ConfluentSchemaRegistry + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ConfluentSchemaRegistry: %+v", err) + } + return out, nil + } + + type RawTargetServiceBaseImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawTargetServiceBaseImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_userassignedidentityauthinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_userassignedidentityauthinfo.go new file mode 100644 index 000000000000..2202d6498670 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_userassignedidentityauthinfo.go @@ -0,0 +1,42 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AuthInfoBase = UserAssignedIdentityAuthInfo{} + +type UserAssignedIdentityAuthInfo struct { + ClientId *string `json:"clientId,omitempty"` + SubscriptionId *string `json:"subscriptionId,omitempty"` + + // Fields inherited from AuthInfoBase +} + +var _ json.Marshaler = UserAssignedIdentityAuthInfo{} + +func (s UserAssignedIdentityAuthInfo) MarshalJSON() ([]byte, error) { + type wrapper UserAssignedIdentityAuthInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling UserAssignedIdentityAuthInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling UserAssignedIdentityAuthInfo: %+v", err) + } + decoded["authType"] = "userAssignedIdentity" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling UserAssignedIdentityAuthInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_validateoperationresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_validateoperationresult.go new file mode 100644 index 000000000000..658f55f0217b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_validateoperationresult.go @@ -0,0 +1,10 @@ +package links + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateOperationResult struct { + Properties *ValidateResult `json:"properties,omitempty"` + ResourceId *string `json:"resourceId,omitempty"` + Status *string `json:"status,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_validateresult.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_validateresult.go new file mode 100644 index 000000000000..59cf09cd739e --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_validateresult.go @@ -0,0 +1,45 @@ +package links + +import ( + "time" + + "github.com/hashicorp/go-azure-helpers/lang/dates" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidateResult struct { + AuthType *AuthType `json:"authType,omitempty"` + IsConnectionAvailable *bool `json:"isConnectionAvailable,omitempty"` + LinkerName *string `json:"linkerName,omitempty"` + ReportEndTimeUtc *string `json:"reportEndTimeUtc,omitempty"` + ReportStartTimeUtc *string `json:"reportStartTimeUtc,omitempty"` + SourceId *string `json:"sourceId,omitempty"` + TargetId *string `json:"targetId,omitempty"` + ValidationDetail *[]ValidationResultItem `json:"validationDetail,omitempty"` +} + +func (o *ValidateResult) GetReportEndTimeUtcAsTime() (*time.Time, error) { + if o.ReportEndTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ReportEndTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *ValidateResult) SetReportEndTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ReportEndTimeUtc = &formatted +} + +func (o *ValidateResult) GetReportStartTimeUtcAsTime() (*time.Time, error) { + if o.ReportStartTimeUtc == nil { + return nil, nil + } + return dates.ParseAsFormat(o.ReportStartTimeUtc, "2006-01-02T15:04:05Z07:00") +} + +func (o *ValidateResult) SetReportStartTimeUtcAsTime(input time.Time) { + formatted := input.Format("2006-01-02T15:04:05Z07:00") + o.ReportStartTimeUtc = &formatted +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_validationresultitem.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_validationresultitem.go new file mode 100644 index 000000000000..36afba86e06b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_validationresultitem.go @@ -0,0 +1,12 @@ +package links + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ValidationResultItem struct { + Description *string `json:"description,omitempty"` + ErrorCode *string `json:"errorCode,omitempty"` + ErrorMessage *string `json:"errorMessage,omitempty"` + Name *string `json:"name,omitempty"` + Result *ValidationResultStatus `json:"result,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_valuesecretinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_valuesecretinfo.go new file mode 100644 index 000000000000..a10b8af91267 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_valuesecretinfo.go @@ -0,0 +1,41 @@ +package links + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SecretInfoBase = ValueSecretInfo{} + +type ValueSecretInfo struct { + Value *string `json:"value,omitempty"` + + // Fields inherited from SecretInfoBase +} + +var _ json.Marshaler = ValueSecretInfo{} + +func (s ValueSecretInfo) MarshalJSON() ([]byte, error) { + type wrapper ValueSecretInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ValueSecretInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ValueSecretInfo: %+v", err) + } + decoded["secretType"] = "rawValue" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ValueSecretInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_vnetsolution.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_vnetsolution.go new file mode 100644 index 000000000000..b044740907b3 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/model_vnetsolution.go @@ -0,0 +1,8 @@ +package links + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VNetSolution struct { + Type *VNetSolutionType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/version.go new file mode 100644 index 000000000000..b0046c85418a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links/version.go @@ -0,0 +1,12 @@ +package links + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/links/%s", defaultApiVersion) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/README.md b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/README.md new file mode 100644 index 000000000000..f8c7d596c00a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/README.md @@ -0,0 +1,70 @@ + +## `github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker` Documentation + +The `servicelinker` SDK allows for interaction with the Azure Resource Manager Service `servicelinker` (API Version `2022-05-01`). + +This readme covers example usages, but further information on [using this SDK can be found in the project root](https://github.com/hashicorp/go-azure-sdk/tree/main/docs). + +### Import Path + +```go +import "github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker" +``` + + +### Client Initialization + +```go +client := servicelinker.NewServicelinkerClientWithBaseURI("https://management.azure.com") +client.Client.Authorizer = authorizer +``` + + +### Example Usage: `ServicelinkerClient.LinkerCreateOrUpdate` + +```go +ctx := context.TODO() +id := servicelinker.NewScopedLinkerID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "linkerValue") + +payload := servicelinker.LinkerResource{ + // ... +} + + +if err := client.LinkerCreateOrUpdateThenPoll(ctx, id, payload); err != nil { + // handle the error +} +``` + + +### Example Usage: `ServicelinkerClient.LinkerGet` + +```go +ctx := context.TODO() +id := servicelinker.NewScopedLinkerID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group", "linkerValue") + +read, err := client.LinkerGet(ctx, id) +if err != nil { + // handle the error +} +if model := read.Model; model != nil { + // do something with the model/response object +} +``` + + +### Example Usage: `ServicelinkerClient.LinkerList` + +```go +ctx := context.TODO() +id := servicelinker.NewScopeID("/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group") + +// alternatively `client.LinkerList(ctx, id)` can be used to do batched pagination +items, err := client.LinkerListComplete(ctx, id) +if err != nil { + // handle the error +} +for _, item := range items { + // do something +} +``` diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/client.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/client.go new file mode 100644 index 000000000000..ab0c516022a9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/client.go @@ -0,0 +1,18 @@ +package servicelinker + +import "github.com/Azure/go-autorest/autorest" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type ServicelinkerClient struct { + Client autorest.Client + baseUri string +} + +func NewServicelinkerClientWithBaseURI(endpoint string) ServicelinkerClient { + return ServicelinkerClient{ + Client: autorest.NewClientWithUserAgent(userAgent()), + baseUri: endpoint, + } +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/constants.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/constants.go new file mode 100644 index 000000000000..e06d789983ed --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/constants.go @@ -0,0 +1,213 @@ +package servicelinker + +import "strings" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthType string + +const ( + AuthTypeSecret AuthType = "secret" + AuthTypeServicePrincipalCertificate AuthType = "servicePrincipalCertificate" + AuthTypeServicePrincipalSecret AuthType = "servicePrincipalSecret" + AuthTypeSystemAssignedIdentity AuthType = "systemAssignedIdentity" + AuthTypeUserAssignedIdentity AuthType = "userAssignedIdentity" +) + +func PossibleValuesForAuthType() []string { + return []string{ + string(AuthTypeSecret), + string(AuthTypeServicePrincipalCertificate), + string(AuthTypeServicePrincipalSecret), + string(AuthTypeSystemAssignedIdentity), + string(AuthTypeUserAssignedIdentity), + } +} + +func parseAuthType(input string) (*AuthType, error) { + vals := map[string]AuthType{ + "secret": AuthTypeSecret, + "serviceprincipalcertificate": AuthTypeServicePrincipalCertificate, + "serviceprincipalsecret": AuthTypeServicePrincipalSecret, + "systemassignedidentity": AuthTypeSystemAssignedIdentity, + "userassignedidentity": AuthTypeUserAssignedIdentity, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AuthType(input) + return &out, nil +} + +type AzureResourceType string + +const ( + AzureResourceTypeKeyVault AzureResourceType = "KeyVault" +) + +func PossibleValuesForAzureResourceType() []string { + return []string{ + string(AzureResourceTypeKeyVault), + } +} + +func parseAzureResourceType(input string) (*AzureResourceType, error) { + vals := map[string]AzureResourceType{ + "keyvault": AzureResourceTypeKeyVault, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := AzureResourceType(input) + return &out, nil +} + +type ClientType string + +const ( + ClientTypeDjango ClientType = "django" + ClientTypeDotnet ClientType = "dotnet" + ClientTypeGo ClientType = "go" + ClientTypeJava ClientType = "java" + ClientTypeKafkaNegativespringBoot ClientType = "kafka-springBoot" + ClientTypeNodejs ClientType = "nodejs" + ClientTypeNone ClientType = "none" + ClientTypePhp ClientType = "php" + ClientTypePython ClientType = "python" + ClientTypeRuby ClientType = "ruby" + ClientTypeSpringBoot ClientType = "springBoot" +) + +func PossibleValuesForClientType() []string { + return []string{ + string(ClientTypeDjango), + string(ClientTypeDotnet), + string(ClientTypeGo), + string(ClientTypeJava), + string(ClientTypeKafkaNegativespringBoot), + string(ClientTypeNodejs), + string(ClientTypeNone), + string(ClientTypePhp), + string(ClientTypePython), + string(ClientTypeRuby), + string(ClientTypeSpringBoot), + } +} + +func parseClientType(input string) (*ClientType, error) { + vals := map[string]ClientType{ + "django": ClientTypeDjango, + "dotnet": ClientTypeDotnet, + "go": ClientTypeGo, + "java": ClientTypeJava, + "kafka-springboot": ClientTypeKafkaNegativespringBoot, + "nodejs": ClientTypeNodejs, + "none": ClientTypeNone, + "php": ClientTypePhp, + "python": ClientTypePython, + "ruby": ClientTypeRuby, + "springboot": ClientTypeSpringBoot, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := ClientType(input) + return &out, nil +} + +type SecretType string + +const ( + SecretTypeKeyVaultSecretReference SecretType = "keyVaultSecretReference" + SecretTypeKeyVaultSecretUri SecretType = "keyVaultSecretUri" + SecretTypeRawValue SecretType = "rawValue" +) + +func PossibleValuesForSecretType() []string { + return []string{ + string(SecretTypeKeyVaultSecretReference), + string(SecretTypeKeyVaultSecretUri), + string(SecretTypeRawValue), + } +} + +func parseSecretType(input string) (*SecretType, error) { + vals := map[string]SecretType{ + "keyvaultsecretreference": SecretTypeKeyVaultSecretReference, + "keyvaultsecreturi": SecretTypeKeyVaultSecretUri, + "rawvalue": SecretTypeRawValue, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := SecretType(input) + return &out, nil +} + +type TargetServiceType string + +const ( + TargetServiceTypeAzureResource TargetServiceType = "AzureResource" + TargetServiceTypeConfluentBootstrapServer TargetServiceType = "ConfluentBootstrapServer" + TargetServiceTypeConfluentSchemaRegistry TargetServiceType = "ConfluentSchemaRegistry" +) + +func PossibleValuesForTargetServiceType() []string { + return []string{ + string(TargetServiceTypeAzureResource), + string(TargetServiceTypeConfluentBootstrapServer), + string(TargetServiceTypeConfluentSchemaRegistry), + } +} + +func parseTargetServiceType(input string) (*TargetServiceType, error) { + vals := map[string]TargetServiceType{ + "azureresource": TargetServiceTypeAzureResource, + "confluentbootstrapserver": TargetServiceTypeConfluentBootstrapServer, + "confluentschemaregistry": TargetServiceTypeConfluentSchemaRegistry, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := TargetServiceType(input) + return &out, nil +} + +type VNetSolutionType string + +const ( + VNetSolutionTypePrivateLink VNetSolutionType = "privateLink" + VNetSolutionTypeServiceEndpoint VNetSolutionType = "serviceEndpoint" +) + +func PossibleValuesForVNetSolutionType() []string { + return []string{ + string(VNetSolutionTypePrivateLink), + string(VNetSolutionTypeServiceEndpoint), + } +} + +func parseVNetSolutionType(input string) (*VNetSolutionType, error) { + vals := map[string]VNetSolutionType{ + "privatelink": VNetSolutionTypePrivateLink, + "serviceendpoint": VNetSolutionTypeServiceEndpoint, + } + if v, ok := vals[strings.ToLower(input)]; ok { + return &v, nil + } + + // otherwise presume it's an undefined value and best-effort it + out := VNetSolutionType(input) + return &out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/id_scopedlinker.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/id_scopedlinker.go new file mode 100644 index 000000000000..a5cd285ad5aa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/id_scopedlinker.go @@ -0,0 +1,110 @@ +package servicelinker + +import ( + "fmt" + "strings" + + "github.com/hashicorp/go-azure-helpers/resourcemanager/resourceids" +) + +var _ resourceids.ResourceId = ScopedLinkerId{} + +// ScopedLinkerId is a struct representing the Resource ID for a Scoped Linker +type ScopedLinkerId struct { + ResourceUri string + LinkerName string +} + +// NewScopedLinkerID returns a new ScopedLinkerId struct +func NewScopedLinkerID(resourceUri string, linkerName string) ScopedLinkerId { + return ScopedLinkerId{ + ResourceUri: resourceUri, + LinkerName: linkerName, + } +} + +// ParseScopedLinkerID parses 'input' into a ScopedLinkerId +func ParseScopedLinkerID(input string) (*ScopedLinkerId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedLinkerId{}) + parsed, err := parser.Parse(input, false) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedLinkerId{} + + if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { + return nil, fmt.Errorf("the segment 'resourceUri' was not found in the resource id %q", input) + } + + if id.LinkerName, ok = parsed.Parsed["linkerName"]; !ok { + return nil, fmt.Errorf("the segment 'linkerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ParseScopedLinkerIDInsensitively parses 'input' case-insensitively into a ScopedLinkerId +// note: this method should only be used for API response data and not user input +func ParseScopedLinkerIDInsensitively(input string) (*ScopedLinkerId, error) { + parser := resourceids.NewParserFromResourceIdType(ScopedLinkerId{}) + parsed, err := parser.Parse(input, true) + if err != nil { + return nil, fmt.Errorf("parsing %q: %+v", input, err) + } + + var ok bool + id := ScopedLinkerId{} + + if id.ResourceUri, ok = parsed.Parsed["resourceUri"]; !ok { + return nil, fmt.Errorf("the segment 'resourceUri' was not found in the resource id %q", input) + } + + if id.LinkerName, ok = parsed.Parsed["linkerName"]; !ok { + return nil, fmt.Errorf("the segment 'linkerName' was not found in the resource id %q", input) + } + + return &id, nil +} + +// ValidateScopedLinkerID checks that 'input' can be parsed as a Scoped Linker ID +func ValidateScopedLinkerID(input interface{}, key string) (warnings []string, errors []error) { + v, ok := input.(string) + if !ok { + errors = append(errors, fmt.Errorf("expected %q to be a string", key)) + return + } + + if _, err := ParseScopedLinkerID(v); err != nil { + errors = append(errors, err) + } + + return +} + +// ID returns the formatted Scoped Linker ID +func (id ScopedLinkerId) ID() string { + fmtString := "/%s/providers/Microsoft.ServiceLinker/linkers/%s" + return fmt.Sprintf(fmtString, strings.TrimPrefix(id.ResourceUri, "/"), id.LinkerName) +} + +// Segments returns a slice of Resource ID Segments which comprise this Scoped Linker ID +func (id ScopedLinkerId) Segments() []resourceids.Segment { + return []resourceids.Segment{ + resourceids.ScopeSegment("resourceUri", "/subscriptions/12345678-1234-9876-4563-123456789012/resourceGroups/some-resource-group"), + resourceids.StaticSegment("staticProviders", "providers", "providers"), + resourceids.ResourceProviderSegment("staticMicrosoftServiceLinker", "Microsoft.ServiceLinker", "Microsoft.ServiceLinker"), + resourceids.StaticSegment("staticLinkers", "linkers", "linkers"), + resourceids.UserSpecifiedSegment("linkerName", "linkerValue"), + } +} + +// String returns a human-readable description of this Scoped Linker ID +func (id ScopedLinkerId) String() string { + components := []string{ + fmt.Sprintf("Resource Uri: %q", id.ResourceUri), + fmt.Sprintf("Linker Name: %q", id.LinkerName), + } + return fmt.Sprintf("Scoped Linker (%s)", strings.Join(components, "\n")) +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/method_linkercreateorupdate_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/method_linkercreateorupdate_autorest.go new file mode 100644 index 000000000000..73b8f7cb74c1 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/method_linkercreateorupdate_autorest.go @@ -0,0 +1,79 @@ +package servicelinker + +import ( + "context" + "fmt" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/polling" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkerCreateOrUpdateOperationResponse struct { + Poller polling.LongRunningPoller + HttpResponse *http.Response +} + +// LinkerCreateOrUpdate ... +func (c ServicelinkerClient) LinkerCreateOrUpdate(ctx context.Context, id ScopedLinkerId, input LinkerResource) (result LinkerCreateOrUpdateOperationResponse, err error) { + req, err := c.preparerForLinkerCreateOrUpdate(ctx, id, input) + if err != nil { + err = autorest.NewErrorWithError(err, "servicelinker.ServicelinkerClient", "LinkerCreateOrUpdate", nil, "Failure preparing request") + return + } + + result, err = c.senderForLinkerCreateOrUpdate(ctx, req) + if err != nil { + err = autorest.NewErrorWithError(err, "servicelinker.ServicelinkerClient", "LinkerCreateOrUpdate", result.HttpResponse, "Failure sending request") + return + } + + return +} + +// LinkerCreateOrUpdateThenPoll performs LinkerCreateOrUpdate then polls until it's completed +func (c ServicelinkerClient) LinkerCreateOrUpdateThenPoll(ctx context.Context, id ScopedLinkerId, input LinkerResource) error { + result, err := c.LinkerCreateOrUpdate(ctx, id, input) + if err != nil { + return fmt.Errorf("performing LinkerCreateOrUpdate: %+v", err) + } + + if err := result.Poller.PollUntilDone(); err != nil { + return fmt.Errorf("polling after LinkerCreateOrUpdate: %+v", err) + } + + return nil +} + +// preparerForLinkerCreateOrUpdate prepares the LinkerCreateOrUpdate request. +func (c ServicelinkerClient) preparerForLinkerCreateOrUpdate(ctx context.Context, id ScopedLinkerId, input LinkerResource) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsPut(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithJSON(input), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// senderForLinkerCreateOrUpdate sends the LinkerCreateOrUpdate request. The method will close the +// http.Response Body if it receives an error. +func (c ServicelinkerClient) senderForLinkerCreateOrUpdate(ctx context.Context, req *http.Request) (future LinkerCreateOrUpdateOperationResponse, err error) { + var resp *http.Response + resp, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + return + } + + future.Poller, err = polling.NewPollerFromResponse(ctx, resp, c.Client, req.Method) + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/method_linkerget_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/method_linkerget_autorest.go new file mode 100644 index 000000000000..2097d66f31c8 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/method_linkerget_autorest.go @@ -0,0 +1,68 @@ +package servicelinker + +import ( + "context" + "net/http" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkerGetOperationResponse struct { + HttpResponse *http.Response + Model *LinkerResource +} + +// LinkerGet ... +func (c ServicelinkerClient) LinkerGet(ctx context.Context, id ScopedLinkerId) (result LinkerGetOperationResponse, err error) { + req, err := c.preparerForLinkerGet(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servicelinker.ServicelinkerClient", "LinkerGet", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servicelinker.ServicelinkerClient", "LinkerGet", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLinkerGet(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servicelinker.ServicelinkerClient", "LinkerGet", result.HttpResponse, "Failure responding to request") + return + } + + return +} + +// preparerForLinkerGet prepares the LinkerGet request. +func (c ServicelinkerClient) preparerForLinkerGet(ctx context.Context, id ScopedLinkerId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(id.ID()), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLinkerGet handles the response to the LinkerGet request. The method always +// closes the http.Response Body. +func (c ServicelinkerClient) responderForLinkerGet(resp *http.Response) (result LinkerGetOperationResponse, err error) { + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&result.Model), + autorest.ByClosing()) + result.HttpResponse = resp + + return +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/method_linkerlist_autorest.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/method_linkerlist_autorest.go new file mode 100644 index 000000000000..92af41f72204 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/method_linkerlist_autorest.go @@ -0,0 +1,187 @@ +package servicelinker + +import ( + "context" + "fmt" + "net/http" + "net/url" + + "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/autorest/azure" + "github.com/hashicorp/go-azure-helpers/resourcemanager/commonids" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkerListOperationResponse struct { + HttpResponse *http.Response + Model *[]LinkerResource + + nextLink *string + nextPageFunc func(ctx context.Context, nextLink string) (LinkerListOperationResponse, error) +} + +type LinkerListCompleteResult struct { + Items []LinkerResource +} + +func (r LinkerListOperationResponse) HasMore() bool { + return r.nextLink != nil +} + +func (r LinkerListOperationResponse) LoadMore(ctx context.Context) (resp LinkerListOperationResponse, err error) { + if !r.HasMore() { + err = fmt.Errorf("no more pages returned") + return + } + return r.nextPageFunc(ctx, *r.nextLink) +} + +// LinkerList ... +func (c ServicelinkerClient) LinkerList(ctx context.Context, id commonids.ScopeId) (resp LinkerListOperationResponse, err error) { + req, err := c.preparerForLinkerList(ctx, id) + if err != nil { + err = autorest.NewErrorWithError(err, "servicelinker.ServicelinkerClient", "LinkerList", nil, "Failure preparing request") + return + } + + resp.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servicelinker.ServicelinkerClient", "LinkerList", resp.HttpResponse, "Failure sending request") + return + } + + resp, err = c.responderForLinkerList(resp.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servicelinker.ServicelinkerClient", "LinkerList", resp.HttpResponse, "Failure responding to request") + return + } + return +} + +// preparerForLinkerList prepares the LinkerList request. +func (c ServicelinkerClient) preparerForLinkerList(ctx context.Context, id commonids.ScopeId) (*http.Request, error) { + queryParameters := map[string]interface{}{ + "api-version": defaultApiVersion, + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(fmt.Sprintf("%s/providers/Microsoft.ServiceLinker/linkers", id.ID())), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// preparerForLinkerListWithNextLink prepares the LinkerList request with the given nextLink token. +func (c ServicelinkerClient) preparerForLinkerListWithNextLink(ctx context.Context, nextLink string) (*http.Request, error) { + uri, err := url.Parse(nextLink) + if err != nil { + return nil, fmt.Errorf("parsing nextLink %q: %+v", nextLink, err) + } + queryParameters := map[string]interface{}{} + for k, v := range uri.Query() { + if len(v) == 0 { + continue + } + val := v[0] + val = autorest.Encode("query", val) + queryParameters[k] = val + } + + preparer := autorest.CreatePreparer( + autorest.AsContentType("application/json; charset=utf-8"), + autorest.AsGet(), + autorest.WithBaseURL(c.baseUri), + autorest.WithPath(uri.Path), + autorest.WithQueryParameters(queryParameters)) + return preparer.Prepare((&http.Request{}).WithContext(ctx)) +} + +// responderForLinkerList handles the response to the LinkerList request. The method always +// closes the http.Response Body. +func (c ServicelinkerClient) responderForLinkerList(resp *http.Response) (result LinkerListOperationResponse, err error) { + type page struct { + Values []LinkerResource `json:"value"` + NextLink *string `json:"nextLink"` + } + var respObj page + err = autorest.Respond( + resp, + azure.WithErrorUnlessStatusCode(http.StatusOK), + autorest.ByUnmarshallingJSON(&respObj), + autorest.ByClosing()) + result.HttpResponse = resp + result.Model = &respObj.Values + result.nextLink = respObj.NextLink + if respObj.NextLink != nil { + result.nextPageFunc = func(ctx context.Context, nextLink string) (result LinkerListOperationResponse, err error) { + req, err := c.preparerForLinkerListWithNextLink(ctx, nextLink) + if err != nil { + err = autorest.NewErrorWithError(err, "servicelinker.ServicelinkerClient", "LinkerList", nil, "Failure preparing request") + return + } + + result.HttpResponse, err = c.Client.Send(req, azure.DoRetryWithRegistration(c.Client)) + if err != nil { + err = autorest.NewErrorWithError(err, "servicelinker.ServicelinkerClient", "LinkerList", result.HttpResponse, "Failure sending request") + return + } + + result, err = c.responderForLinkerList(result.HttpResponse) + if err != nil { + err = autorest.NewErrorWithError(err, "servicelinker.ServicelinkerClient", "LinkerList", result.HttpResponse, "Failure responding to request") + return + } + + return + } + } + return +} + +// LinkerListComplete retrieves all of the results into a single object +func (c ServicelinkerClient) LinkerListComplete(ctx context.Context, id commonids.ScopeId) (LinkerListCompleteResult, error) { + return c.LinkerListCompleteMatchingPredicate(ctx, id, LinkerResourceOperationPredicate{}) +} + +// LinkerListCompleteMatchingPredicate retrieves all of the results and then applied the predicate +func (c ServicelinkerClient) LinkerListCompleteMatchingPredicate(ctx context.Context, id commonids.ScopeId, predicate LinkerResourceOperationPredicate) (resp LinkerListCompleteResult, err error) { + items := make([]LinkerResource, 0) + + page, err := c.LinkerList(ctx, id) + if err != nil { + err = fmt.Errorf("loading the initial page: %+v", err) + return + } + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + + for page.HasMore() { + page, err = page.LoadMore(ctx) + if err != nil { + err = fmt.Errorf("loading the next page: %+v", err) + return + } + + if page.Model != nil { + for _, v := range *page.Model { + if predicate.Matches(v) { + items = append(items, v) + } + } + } + } + + out := LinkerListCompleteResult{ + Items: items, + } + return out, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_authinfobase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_authinfobase.go new file mode 100644 index 000000000000..f2b01e0be4b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_authinfobase.go @@ -0,0 +1,80 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AuthInfoBase interface { +} + +func unmarshalAuthInfoBaseImplementation(input []byte) (AuthInfoBase, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling AuthInfoBase into map[string]interface: %+v", err) + } + + value, ok := temp["authType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "secret") { + var out SecretAuthInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SecretAuthInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "servicePrincipalCertificate") { + var out ServicePrincipalCertificateAuthInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServicePrincipalCertificateAuthInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "servicePrincipalSecret") { + var out ServicePrincipalSecretAuthInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ServicePrincipalSecretAuthInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "systemAssignedIdentity") { + var out SystemAssignedIdentityAuthInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into SystemAssignedIdentityAuthInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "userAssignedIdentity") { + var out UserAssignedIdentityAuthInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into UserAssignedIdentityAuthInfo: %+v", err) + } + return out, nil + } + + type RawAuthInfoBaseImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawAuthInfoBaseImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_azurekeyvaultproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_azurekeyvaultproperties.go new file mode 100644 index 000000000000..68ba606d2167 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_azurekeyvaultproperties.go @@ -0,0 +1,41 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AzureResourcePropertiesBase = AzureKeyVaultProperties{} + +type AzureKeyVaultProperties struct { + ConnectAsKubernetesCsiDriver *bool `json:"connectAsKubernetesCsiDriver,omitempty"` + + // Fields inherited from AzureResourcePropertiesBase +} + +var _ json.Marshaler = AzureKeyVaultProperties{} + +func (s AzureKeyVaultProperties) MarshalJSON() ([]byte, error) { + type wrapper AzureKeyVaultProperties + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureKeyVaultProperties: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureKeyVaultProperties: %+v", err) + } + decoded["type"] = "KeyVault" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureKeyVaultProperties: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_azureresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_azureresource.go new file mode 100644 index 000000000000..ce0dcb00a30c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_azureresource.go @@ -0,0 +1,68 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ TargetServiceBase = AzureResource{} + +type AzureResource struct { + Id *string `json:"id,omitempty"` + ResourceProperties AzureResourcePropertiesBase `json:"resourceProperties"` + + // Fields inherited from TargetServiceBase +} + +var _ json.Marshaler = AzureResource{} + +func (s AzureResource) MarshalJSON() ([]byte, error) { + type wrapper AzureResource + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling AzureResource: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling AzureResource: %+v", err) + } + decoded["type"] = "AzureResource" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling AzureResource: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &AzureResource{} + +func (s *AzureResource) UnmarshalJSON(bytes []byte) error { + type alias AzureResource + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into AzureResource: %+v", err) + } + + s.Id = decoded.Id + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling AzureResource into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["resourceProperties"]; ok { + impl, err := unmarshalAzureResourcePropertiesBaseImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'ResourceProperties' for 'AzureResource': %+v", err) + } + s.ResourceProperties = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_azureresourcepropertiesbase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_azureresourcepropertiesbase.go new file mode 100644 index 000000000000..eeb0f3dc58eb --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_azureresourcepropertiesbase.go @@ -0,0 +1,48 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type AzureResourcePropertiesBase interface { +} + +func unmarshalAzureResourcePropertiesBaseImplementation(input []byte) (AzureResourcePropertiesBase, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling AzureResourcePropertiesBase into map[string]interface: %+v", err) + } + + value, ok := temp["type"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "KeyVault") { + var out AzureKeyVaultProperties + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureKeyVaultProperties: %+v", err) + } + return out, nil + } + + type RawAzureResourcePropertiesBaseImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawAzureResourcePropertiesBaseImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_confluentbootstrapserver.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_confluentbootstrapserver.go new file mode 100644 index 000000000000..f35c8799a1f7 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_confluentbootstrapserver.go @@ -0,0 +1,41 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ TargetServiceBase = ConfluentBootstrapServer{} + +type ConfluentBootstrapServer struct { + Endpoint *string `json:"endpoint,omitempty"` + + // Fields inherited from TargetServiceBase +} + +var _ json.Marshaler = ConfluentBootstrapServer{} + +func (s ConfluentBootstrapServer) MarshalJSON() ([]byte, error) { + type wrapper ConfluentBootstrapServer + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ConfluentBootstrapServer: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ConfluentBootstrapServer: %+v", err) + } + decoded["type"] = "ConfluentBootstrapServer" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ConfluentBootstrapServer: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_confluentschemaregistry.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_confluentschemaregistry.go new file mode 100644 index 000000000000..5d5bfe99668c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_confluentschemaregistry.go @@ -0,0 +1,41 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ TargetServiceBase = ConfluentSchemaRegistry{} + +type ConfluentSchemaRegistry struct { + Endpoint *string `json:"endpoint,omitempty"` + + // Fields inherited from TargetServiceBase +} + +var _ json.Marshaler = ConfluentSchemaRegistry{} + +func (s ConfluentSchemaRegistry) MarshalJSON() ([]byte, error) { + type wrapper ConfluentSchemaRegistry + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ConfluentSchemaRegistry: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ConfluentSchemaRegistry: %+v", err) + } + decoded["type"] = "ConfluentSchemaRegistry" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ConfluentSchemaRegistry: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_keyvaultsecretreferencesecretinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_keyvaultsecretreferencesecretinfo.go new file mode 100644 index 000000000000..ba11cd6c5369 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_keyvaultsecretreferencesecretinfo.go @@ -0,0 +1,42 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SecretInfoBase = KeyVaultSecretReferenceSecretInfo{} + +type KeyVaultSecretReferenceSecretInfo struct { + Name *string `json:"name,omitempty"` + Version *string `json:"version,omitempty"` + + // Fields inherited from SecretInfoBase +} + +var _ json.Marshaler = KeyVaultSecretReferenceSecretInfo{} + +func (s KeyVaultSecretReferenceSecretInfo) MarshalJSON() ([]byte, error) { + type wrapper KeyVaultSecretReferenceSecretInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling KeyVaultSecretReferenceSecretInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling KeyVaultSecretReferenceSecretInfo: %+v", err) + } + decoded["secretType"] = "keyVaultSecretReference" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling KeyVaultSecretReferenceSecretInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_keyvaultsecreturisecretinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_keyvaultsecreturisecretinfo.go new file mode 100644 index 000000000000..31c102db91cd --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_keyvaultsecreturisecretinfo.go @@ -0,0 +1,41 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SecretInfoBase = KeyVaultSecretUriSecretInfo{} + +type KeyVaultSecretUriSecretInfo struct { + Value *string `json:"value,omitempty"` + + // Fields inherited from SecretInfoBase +} + +var _ json.Marshaler = KeyVaultSecretUriSecretInfo{} + +func (s KeyVaultSecretUriSecretInfo) MarshalJSON() ([]byte, error) { + type wrapper KeyVaultSecretUriSecretInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling KeyVaultSecretUriSecretInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling KeyVaultSecretUriSecretInfo: %+v", err) + } + decoded["secretType"] = "keyVaultSecretUri" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling KeyVaultSecretUriSecretInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_linkerproperties.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_linkerproperties.go new file mode 100644 index 000000000000..7a9d4236387d --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_linkerproperties.go @@ -0,0 +1,57 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkerProperties struct { + AuthInfo AuthInfoBase `json:"authInfo"` + ClientType *ClientType `json:"clientType,omitempty"` + ProvisioningState *string `json:"provisioningState,omitempty"` + Scope *string `json:"scope,omitempty"` + SecretStore *SecretStore `json:"secretStore,omitempty"` + TargetService TargetServiceBase `json:"targetService"` + VNetSolution *VNetSolution `json:"vNetSolution,omitempty"` +} + +var _ json.Unmarshaler = &LinkerProperties{} + +func (s *LinkerProperties) UnmarshalJSON(bytes []byte) error { + type alias LinkerProperties + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into LinkerProperties: %+v", err) + } + + s.ClientType = decoded.ClientType + s.ProvisioningState = decoded.ProvisioningState + s.Scope = decoded.Scope + s.SecretStore = decoded.SecretStore + s.VNetSolution = decoded.VNetSolution + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling LinkerProperties into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["authInfo"]; ok { + impl, err := unmarshalAuthInfoBaseImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'AuthInfo' for 'LinkerProperties': %+v", err) + } + s.AuthInfo = impl + } + + if v, ok := temp["targetService"]; ok { + impl, err := unmarshalTargetServiceBaseImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'TargetService' for 'LinkerProperties': %+v", err) + } + s.TargetService = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_linkerresource.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_linkerresource.go new file mode 100644 index 000000000000..50fe0cbc6337 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_linkerresource.go @@ -0,0 +1,16 @@ +package servicelinker + +import ( + "github.com/hashicorp/go-azure-helpers/resourcemanager/systemdata" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type LinkerResource struct { + Id *string `json:"id,omitempty"` + Name *string `json:"name,omitempty"` + Properties LinkerProperties `json:"properties"` + SystemData *systemdata.SystemData `json:"systemData,omitempty"` + Type *string `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_secretauthinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_secretauthinfo.go new file mode 100644 index 000000000000..f5989cbb006b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_secretauthinfo.go @@ -0,0 +1,68 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AuthInfoBase = SecretAuthInfo{} + +type SecretAuthInfo struct { + Name *string `json:"name,omitempty"` + SecretInfo SecretInfoBase `json:"secretInfo"` + + // Fields inherited from AuthInfoBase +} + +var _ json.Marshaler = SecretAuthInfo{} + +func (s SecretAuthInfo) MarshalJSON() ([]byte, error) { + type wrapper SecretAuthInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SecretAuthInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SecretAuthInfo: %+v", err) + } + decoded["authType"] = "secret" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SecretAuthInfo: %+v", err) + } + + return encoded, nil +} + +var _ json.Unmarshaler = &SecretAuthInfo{} + +func (s *SecretAuthInfo) UnmarshalJSON(bytes []byte) error { + type alias SecretAuthInfo + var decoded alias + if err := json.Unmarshal(bytes, &decoded); err != nil { + return fmt.Errorf("unmarshaling into SecretAuthInfo: %+v", err) + } + + s.Name = decoded.Name + + var temp map[string]json.RawMessage + if err := json.Unmarshal(bytes, &temp); err != nil { + return fmt.Errorf("unmarshaling SecretAuthInfo into map[string]json.RawMessage: %+v", err) + } + + if v, ok := temp["secretInfo"]; ok { + impl, err := unmarshalSecretInfoBaseImplementation(v) + if err != nil { + return fmt.Errorf("unmarshaling field 'SecretInfo' for 'SecretAuthInfo': %+v", err) + } + s.SecretInfo = impl + } + return nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_secretinfobase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_secretinfobase.go new file mode 100644 index 000000000000..c2f274b25537 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_secretinfobase.go @@ -0,0 +1,64 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecretInfoBase interface { +} + +func unmarshalSecretInfoBaseImplementation(input []byte) (SecretInfoBase, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling SecretInfoBase into map[string]interface: %+v", err) + } + + value, ok := temp["secretType"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "keyVaultSecretReference") { + var out KeyVaultSecretReferenceSecretInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into KeyVaultSecretReferenceSecretInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "keyVaultSecretUri") { + var out KeyVaultSecretUriSecretInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into KeyVaultSecretUriSecretInfo: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "rawValue") { + var out ValueSecretInfo + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ValueSecretInfo: %+v", err) + } + return out, nil + } + + type RawSecretInfoBaseImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawSecretInfoBaseImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_secretstore.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_secretstore.go new file mode 100644 index 000000000000..502da103c9b9 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_secretstore.go @@ -0,0 +1,8 @@ +package servicelinker + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type SecretStore struct { + KeyVaultId *string `json:"keyVaultId,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_serviceprincipalcertificateauthinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_serviceprincipalcertificateauthinfo.go new file mode 100644 index 000000000000..e84cd944fb37 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_serviceprincipalcertificateauthinfo.go @@ -0,0 +1,43 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AuthInfoBase = ServicePrincipalCertificateAuthInfo{} + +type ServicePrincipalCertificateAuthInfo struct { + Certificate string `json:"certificate"` + ClientId string `json:"clientId"` + PrincipalId string `json:"principalId"` + + // Fields inherited from AuthInfoBase +} + +var _ json.Marshaler = ServicePrincipalCertificateAuthInfo{} + +func (s ServicePrincipalCertificateAuthInfo) MarshalJSON() ([]byte, error) { + type wrapper ServicePrincipalCertificateAuthInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServicePrincipalCertificateAuthInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServicePrincipalCertificateAuthInfo: %+v", err) + } + decoded["authType"] = "servicePrincipalCertificate" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServicePrincipalCertificateAuthInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_serviceprincipalsecretauthinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_serviceprincipalsecretauthinfo.go new file mode 100644 index 000000000000..4c3e2d128587 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_serviceprincipalsecretauthinfo.go @@ -0,0 +1,43 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AuthInfoBase = ServicePrincipalSecretAuthInfo{} + +type ServicePrincipalSecretAuthInfo struct { + ClientId string `json:"clientId"` + PrincipalId string `json:"principalId"` + Secret string `json:"secret"` + + // Fields inherited from AuthInfoBase +} + +var _ json.Marshaler = ServicePrincipalSecretAuthInfo{} + +func (s ServicePrincipalSecretAuthInfo) MarshalJSON() ([]byte, error) { + type wrapper ServicePrincipalSecretAuthInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ServicePrincipalSecretAuthInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ServicePrincipalSecretAuthInfo: %+v", err) + } + decoded["authType"] = "servicePrincipalSecret" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ServicePrincipalSecretAuthInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_systemassignedidentityauthinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_systemassignedidentityauthinfo.go new file mode 100644 index 000000000000..1fa2c1ae0392 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_systemassignedidentityauthinfo.go @@ -0,0 +1,40 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AuthInfoBase = SystemAssignedIdentityAuthInfo{} + +type SystemAssignedIdentityAuthInfo struct { + + // Fields inherited from AuthInfoBase +} + +var _ json.Marshaler = SystemAssignedIdentityAuthInfo{} + +func (s SystemAssignedIdentityAuthInfo) MarshalJSON() ([]byte, error) { + type wrapper SystemAssignedIdentityAuthInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling SystemAssignedIdentityAuthInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling SystemAssignedIdentityAuthInfo: %+v", err) + } + decoded["authType"] = "systemAssignedIdentity" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling SystemAssignedIdentityAuthInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_targetservicebase.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_targetservicebase.go new file mode 100644 index 000000000000..a4641ca89f1a --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_targetservicebase.go @@ -0,0 +1,64 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" + "strings" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type TargetServiceBase interface { +} + +func unmarshalTargetServiceBaseImplementation(input []byte) (TargetServiceBase, error) { + if input == nil { + return nil, nil + } + + var temp map[string]interface{} + if err := json.Unmarshal(input, &temp); err != nil { + return nil, fmt.Errorf("unmarshaling TargetServiceBase into map[string]interface: %+v", err) + } + + value, ok := temp["type"].(string) + if !ok { + return nil, nil + } + + if strings.EqualFold(value, "AzureResource") { + var out AzureResource + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into AzureResource: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ConfluentBootstrapServer") { + var out ConfluentBootstrapServer + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ConfluentBootstrapServer: %+v", err) + } + return out, nil + } + + if strings.EqualFold(value, "ConfluentSchemaRegistry") { + var out ConfluentSchemaRegistry + if err := json.Unmarshal(input, &out); err != nil { + return nil, fmt.Errorf("unmarshaling into ConfluentSchemaRegistry: %+v", err) + } + return out, nil + } + + type RawTargetServiceBaseImpl struct { + Type string `json:"-"` + Values map[string]interface{} `json:"-"` + } + out := RawTargetServiceBaseImpl{ + Type: value, + Values: temp, + } + return out, nil + +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_userassignedidentityauthinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_userassignedidentityauthinfo.go new file mode 100644 index 000000000000..5e140e1662fa --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_userassignedidentityauthinfo.go @@ -0,0 +1,42 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ AuthInfoBase = UserAssignedIdentityAuthInfo{} + +type UserAssignedIdentityAuthInfo struct { + ClientId *string `json:"clientId,omitempty"` + SubscriptionId *string `json:"subscriptionId,omitempty"` + + // Fields inherited from AuthInfoBase +} + +var _ json.Marshaler = UserAssignedIdentityAuthInfo{} + +func (s UserAssignedIdentityAuthInfo) MarshalJSON() ([]byte, error) { + type wrapper UserAssignedIdentityAuthInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling UserAssignedIdentityAuthInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling UserAssignedIdentityAuthInfo: %+v", err) + } + decoded["authType"] = "userAssignedIdentity" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling UserAssignedIdentityAuthInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_valuesecretinfo.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_valuesecretinfo.go new file mode 100644 index 000000000000..3c638a82a47c --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_valuesecretinfo.go @@ -0,0 +1,41 @@ +package servicelinker + +import ( + "encoding/json" + "fmt" +) + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +var _ SecretInfoBase = ValueSecretInfo{} + +type ValueSecretInfo struct { + Value *string `json:"value,omitempty"` + + // Fields inherited from SecretInfoBase +} + +var _ json.Marshaler = ValueSecretInfo{} + +func (s ValueSecretInfo) MarshalJSON() ([]byte, error) { + type wrapper ValueSecretInfo + wrapped := wrapper(s) + encoded, err := json.Marshal(wrapped) + if err != nil { + return nil, fmt.Errorf("marshaling ValueSecretInfo: %+v", err) + } + + var decoded map[string]interface{} + if err := json.Unmarshal(encoded, &decoded); err != nil { + return nil, fmt.Errorf("unmarshaling ValueSecretInfo: %+v", err) + } + decoded["secretType"] = "rawValue" + + encoded, err = json.Marshal(decoded) + if err != nil { + return nil, fmt.Errorf("re-marshaling ValueSecretInfo: %+v", err) + } + + return encoded, nil +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_vnetsolution.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_vnetsolution.go new file mode 100644 index 000000000000..cea5b1054da0 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/model_vnetsolution.go @@ -0,0 +1,8 @@ +package servicelinker + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +type VNetSolution struct { + Type *VNetSolutionType `json:"type,omitempty"` +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/predicates.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/predicates.go new file mode 100644 index 000000000000..8fcd494ff91b --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/predicates.go @@ -0,0 +1,24 @@ +package servicelinker + +type LinkerResourceOperationPredicate struct { + Id *string + Name *string + Type *string +} + +func (p LinkerResourceOperationPredicate) Matches(input LinkerResource) bool { + + if p.Id != nil && (input.Id == nil && *p.Id != *input.Id) { + return false + } + + if p.Name != nil && (input.Name == nil && *p.Name != *input.Name) { + return false + } + + if p.Type != nil && (input.Type == nil && *p.Type != *input.Type) { + return false + } + + return true +} diff --git a/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/version.go b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/version.go new file mode 100644 index 000000000000..19cc38ddcb80 --- /dev/null +++ b/vendor/github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker/version.go @@ -0,0 +1,12 @@ +package servicelinker + +import "fmt" + +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See NOTICE.txt in the project root for license information. + +const defaultApiVersion = "2022-05-01" + +func userAgent() string { + return fmt.Sprintf("hashicorp/go-azure-sdk/servicelinker/%s", defaultApiVersion) +} diff --git a/vendor/modules.txt b/vendor/modules.txt index d4bbad146cac..47e6bdce3f43 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -310,6 +310,8 @@ github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview github.com/hashicorp/go-azure-sdk/resource-manager/servicebus/2021-06-01-preview/topicsauthorizationrule github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/managedcluster github.com/hashicorp/go-azure-sdk/resource-manager/servicefabricmanagedcluster/2021-05-01/nodetype +github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/links +github.com/hashicorp/go-azure-sdk/resource-manager/servicelinker/2022-05-01/servicelinker github.com/hashicorp/go-azure-sdk/resource-manager/signalr/2022-02-01/signalr github.com/hashicorp/go-azure-sdk/resource-manager/sqlvirtualmachine/2022-02-01/sqlvirtualmachines github.com/hashicorp/go-azure-sdk/resource-manager/storage/2021-04-01/objectreplicationpolicies diff --git a/website/docs/r/service_connector_app_service.html.markdown b/website/docs/r/service_connector_app_service.html.markdown new file mode 100644 index 000000000000..a44b81475464 --- /dev/null +++ b/website/docs/r/service_connector_app_service.html.markdown @@ -0,0 +1,133 @@ +--- +subcategory: "App Service (Web Apps)" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_app_service_connection" +description: |- + Manages a service connector for app service. +--- + +# azurerm_app_service_connection + +Manages a service connector for app service. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_cosmosdb_account" "example" { + name = "example-cosmosdb-account" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + offer_type = "Standard" + kind = "GlobalDocumentDB" + + consistency_policy { + consistency_level = "BoundedStaleness" + max_interval_in_seconds = 10 + max_staleness_prefix = 200 + } + + geo_location { + location = azurerm_resource_group.example.location + failover_priority = 0 + } +} + +resource "azurerm_cosmosdb_sql_database" "example" { + name = "cosmos-sql-db" + resource_group_name = azurerm_cosmosdb_account.example.resource_group_name + account_name = azurerm_cosmosdb_account.example.name + throughput = 400 +} + +resource "azurerm_cosmosdb_sql_container" "example" { + name = "example-container" + resource_group_name = azurerm_cosmosdb_account.example.resource_group_name + account_name = azurerm_cosmosdb_account.example.name + database_name = azurerm_cosmosdb_sql_database.example.name + partition_key_path = "/definition" +} + +resource "azurerm_service_plan" "example" { + location = azurerm_resource_group.example.location + name = "example-serviceplan" + resource_group_name = azurerm_resource_group.example.name + sku_name = "P1v2" + os_type = "Linux" +} + +resource "azurerm_linux_web_app" "example" { + location = azurerm_resource_group.example.location + name = "example-linuxwebapp" + resource_group_name = azurerm_resource_group.example.name + service_plan_id = azurerm_service_plan.example.id + site_config {} +} + +resource "azurerm_app_service_connection" "example" { + name = "example-serviceconnector" + app_service_id = azurerm_linux_web_app.example.id + target_resource_id = azurerm_cosmosdb_sql_database.example.id + authentication { + type = "systemAssignedIdentity" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the service connection. Changing this forces a new resource to be created. + +* `app_service_id` - (Required) The ID of the data source web app. Changing this forces a new resource to be created. + +* `target_resource_id` - (Required) The ID of the target resource. Changing this forces a new resource to be created. Possible values are `Postgres`, `PostgresFlexible`, `Mysql`, `Sql`, `Redis`, `RedisEnterprise`, `CosmosCassandra`, `CosmosGremlin`, `CosmosMongo`, `CosmosSql`, `CosmosTable`, `StorageBlob`, `StorageQueue`, `StorageFile`, `StorageTable`, `AppConfig`, `EventHub`, `ServiceBus`, `SignalR`, `WebPubSub`, `ConfluentKafka`. + +* `authentication` - (Required) The authentication info. An `authentication` block as defined below. +--- +* `type` - (Required) The authentication type. Possible values are `systemAssignedIdentity`, `userAssignedIdentity`, `servicePrincipalSecret`, `servicePrincipalCertificate`, `secret`. + +* `name` - (Optional) Username or account name for secret auth. `name` and `secret` should be either both specified or both not specified when `type` is set to `secret`. + +* `secret` - (Optional) Password or account key for secret auth. `secret` and `name` should be either both specified or both not specified when `type` is set to `secret`. + +* `client_id` - (Optional) Client ID for `userAssignedIdentity` or `servicePrincipal` auth. Should be specified when `type` is set to `servicePrincipalSecret` or `servicePrincipalCertificate`. When `type` is set to `userAssignedIdentity`, `client_id` and `subscription_id` should be either both specified or both not specified. + +* `subscription_id` - (Optional) Subscription ID for `userAssignedIdentity`. `subscription_id` and `client_id` should be either both specified or both not specified. + +* `principal_id` - (Optional) Principal ID for `servicePrincipal` auth. Should be specified when `type` is set to `servicePrincipalSecret` or `servicePrincipalCertificate`. + +* `certificate` - (Optional) Service principal certificate for `servicePrincipal` auth. Should be specified when `type` is set to `servicePrincipalCertificate`. +--- + +* `client_type` - (Optional) The application client type. Possible values are `dotnet`, `java`, `python`, `go`, `php`, `ruby`, `django`, `nodejs`, `springBoot`. + +* `vnet_solution` - (Optional) The type of the VNet solution. Possible values are `serviceEndpoint`, `privateLink`. + +## Attribute Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the service connector. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Service Connector for app service. +* `read` - (Defaults to 5 minutes) Used when retrieving the Service Connector for app service. +* `update` - (Defaults to 30 minutes) Used when updating the Service Connector for app service. +* `delete` - (Defaults to 30 minutes) Used when deleting the Service Connector for app service. + +## Import + +Service Connector for app service can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_app_service_connection.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.Web/sites/webapp/providers/Microsoft.ServiceLinker/linkers/serviceconnector1 +``` diff --git a/website/docs/r/service_connector_spring_cloud.html.markdown b/website/docs/r/service_connector_spring_cloud.html.markdown new file mode 100644 index 000000000000..49c924f7624c --- /dev/null +++ b/website/docs/r/service_connector_spring_cloud.html.markdown @@ -0,0 +1,138 @@ +--- +subcategory: "Spring Cloud" +layout: "azurerm" +page_title: "Azure Resource Manager: azurerm_spring_cloud_connection" +description: |- + Manages a service connector for spring cloud app. +--- + +# azurerm_spring_cloud_connection + +Manages a service connector for spring cloud app. + +## Example Usage + +```hcl +resource "azurerm_resource_group" "example" { + name = "example-resources" + location = "West Europe" +} + +resource "azurerm_cosmosdb_account" "example" { + name = "example-cosmosdb-account" + location = azurerm_resource_group.example.location + resource_group_name = azurerm_resource_group.example.name + offer_type = "Standard" + kind = "GlobalDocumentDB" + + consistency_policy { + consistency_level = "BoundedStaleness" + max_interval_in_seconds = 10 + max_staleness_prefix = 200 + } + + geo_location { + location = azurerm_resource_group.example.location + failover_priority = 0 + } +} + +resource "azurerm_cosmosdb_sql_database" "example" { + name = "cosmos-sql-db" + resource_group_name = azurerm_cosmosdb_account.example.resource_group_name + account_name = azurerm_cosmosdb_account.example.name + throughput = 400 +} + +resource "azurerm_cosmosdb_sql_container" "example" { + name = "example-container" + resource_group_name = azurerm_cosmosdb_account.example.resource_group_name + account_name = azurerm_cosmosdb_account.example.name + database_name = azurerm_cosmosdb_sql_database.example.name + partition_key_path = "/definition" +} + +resource "azurerm_spring_cloud_service" "example" { + name = "examplespringcloud" + resource_group_name = azurerm_resource_group.example.name + location = azurerm_resource_group.example.location +} + +resource "azurerm_spring_cloud_app" "example" { + name = "examplespringcloudapp" + resource_group_name = azurerm_resource_group.example.name + service_name = azurerm_spring_cloud_service.example.name + + identity { + type = "SystemAssigned" + } +} + +resource "azurerm_spring_cloud_java_deployment" "example" { + name = "exampledeployment" + spring_cloud_app_id = azurerm_spring_cloud_app.example.id +} + +resource "azurerm_spring_cloud_connection" "example" { + name = "example-serviceconnector" + spring_cloud_id = azurerm_spring_cloud_java_deployment.example.id + target_resource_id = azurerm_cosmosdb_sql_database.example.id + authentication { + type = "systemAssignedIdentity" + } +} +``` + +## Argument Reference + +The following arguments are supported: + +* `name` - (Required) The name of the service connection. Changing this forces a new resource to be created. + +* `spring_cloud_id` - (Required) The ID of the data source spring cloud. Changing this forces a new resource to be created. + +* `target_resource_id` - (Required) The ID of the target resource. Changing this forces a new resource to be created. Possible values are `Postgres`, `PostgresFlexible`, `Mysql`, `Sql`, `Redis`, `RedisEnterprise`, `CosmosCassandra`, `CosmosGremlin`, `CosmosMongo`, `CosmosSql`, `CosmosTable`, `StorageBlob`, `StorageQueue`, `StorageFile`, `StorageTable`, `AppConfig`, `EventHub`, `ServiceBus`, `SignalR`, `WebPubSub`, `ConfluentKafka`. + +* `authentication` - (Required) The authentication info. An `authentication` block as defined below. +--- +* `type` - (Required) The authentication type. Possible values are `systemAssignedIdentity`, `userAssignedIdentity`, `servicePrincipalSecret`, `servicePrincipalCertificate`, `secret`. + +* `name` - (Optional) Username or account name for secret auth. `name` and `secret` should be either both specified or both not specified when `type` is set to `secret`. + +* `secret` - (Optional) Password or account key for secret auth. `secret` and `name` should be either both specified or both not specified when `type` is set to `secret`. + +* `client_id` - (Optional) Client ID for `userAssignedIdentity` or `servicePrincipal` auth. Should be specified when `type` is set to `servicePrincipalSecret` or `servicePrincipalCertificate`. When `type` is set to `userAssignedIdentity`, `client_id` and `subscription_id` should be either both specified or both not specified. + +* `subscription_id` - (Optional) Subscription ID for `userAssignedIdentity`. `subscription_id` and `client_id` should be either both specified or both not specified. + +* `principal_id` - (Optional) Principal ID for `servicePrincipal` auth. Should be specified when `type` is set to `servicePrincipalSecret` or `servicePrincipalCertificate`. + +* `certificate` - (Optional) Service principal certificate for `servicePrincipal` auth. Should be specified when `type` is set to `servicePrincipalCertificate`. +--- + +* `client_type` - (Optional) The application client type. Possible values are `dotnet`, `java`, `python`, `go`, `php`, `ruby`, `django`, `nodejs`, `springBoot`. + +* `vnet_solution` - (Optional) The type of the VNet solution. Possible values are `serviceEndpoint`, `privateLink`. + +## Attribute Reference + +In addition to the Arguments listed above - the following Attributes are exported: + +* `id` - The ID of the service connector. + +## Timeouts + +The `timeouts` block allows you to specify [timeouts](https://www.terraform.io/docs/configuration/resources.html#timeouts) for certain actions: + +* `create` - (Defaults to 30 minutes) Used when creating the Service Connector for spring cloud. +* `read` - (Defaults to 5 minutes) Used when retrieving the Service Connector for spring cloud. +* `update` - (Defaults to 30 minutes) Used when updating the Service Connector for spring cloud. +* `delete` - (Defaults to 30 minutes) Used when deleting the Service Connector for spring cloud. + +## Import + +Service Connector for spring cloud can be imported using the `resource id`, e.g. + +```shell +terraform import azurerm_spring_cloud_connection.example /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/group1/providers/Microsoft.AppPlatform/Spring/springcloud/apps/springcloudapp/deployments/deployment/providers/Microsoft.ServiceLinker/linkers/serviceconnector1 +```