public KeyVaultSigningKeyDefinition(KeyVaultSigningKeyType typeDefinition, string subscriptionId, string resourceGroupName, string vaultName, string secretName, string secretVersion)
        {
            if (subscriptionId == null)
            {
                throw new ArgumentNullException(nameof(subscriptionId));
            }
            if (resourceGroupName == null)
            {
                throw new ArgumentNullException(nameof(resourceGroupName));
            }
            if (vaultName == null)
            {
                throw new ArgumentNullException(nameof(vaultName));
            }
            if (secretName == null)
            {
                throw new ArgumentNullException(nameof(secretName));
            }
            if (secretVersion == null)
            {
                throw new ArgumentNullException(nameof(secretVersion));
            }

            TypeDefinition    = typeDefinition;
            SubscriptionId    = subscriptionId;
            ResourceGroupName = resourceGroupName;
            VaultName         = vaultName;
            SecretName        = secretName;
            SecretVersion     = secretVersion;
        }
Example #2
0
        internal static KeyVaultSigningKeyDefinition DeserializeKeyVaultSigningKeyDefinition(JsonElement element)
        {
            KeyVaultSigningKeyType typeName = default;
            string subscriptionId           = default;
            string resourceGroupName        = default;
            string vaultName     = default;
            string secretName    = default;
            string secretVersion = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("typeName"))
                {
                    typeName = new KeyVaultSigningKeyType(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("subscriptionId"))
                {
                    subscriptionId = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("resourceGroupName"))
                {
                    resourceGroupName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("vaultName"))
                {
                    vaultName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("secretName"))
                {
                    secretName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("secretVersion"))
                {
                    secretVersion = property.Value.GetString();
                    continue;
                }
            }
            return(new KeyVaultSigningKeyDefinition(typeName, subscriptionId, resourceGroupName, vaultName, secretName, secretVersion));
        }