Пример #1
0
 internal KeyVaultProperties(string keyName, Uri keyVaultUri, string keyVersion, UserAssignedIdentityProperties identity)
 {
     KeyName     = keyName;
     KeyVaultUri = keyVaultUri;
     KeyVersion  = keyVersion;
     Identity    = identity;
 }
Пример #2
0
        internal static KeyVaultProperties DeserializeKeyVaultProperties(JsonElement element)
        {
            Optional <string> keyName     = default;
            Optional <Uri>    keyVaultUri = default;
            Optional <string> keyVersion  = default;
            Optional <UserAssignedIdentityProperties> identity = default;

            foreach (var property in element.EnumerateObject())
            {
                if (property.NameEquals("keyName"))
                {
                    keyName = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("keyVaultUri"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        keyVaultUri = null;
                        continue;
                    }
                    keyVaultUri = new Uri(property.Value.GetString());
                    continue;
                }
                if (property.NameEquals("keyVersion"))
                {
                    keyVersion = property.Value.GetString();
                    continue;
                }
                if (property.NameEquals("identity"))
                {
                    if (property.Value.ValueKind == JsonValueKind.Null)
                    {
                        property.ThrowNonNullablePropertyIsNull();
                        continue;
                    }
                    identity = UserAssignedIdentityProperties.DeserializeUserAssignedIdentityProperties(property.Value);
                    continue;
                }
            }
            return(new KeyVaultProperties(keyName.Value, keyVaultUri.Value, keyVersion.Value, identity.Value));
        }