Ejemplo n.º 1
0
        /// <summary>
        /// Gets a Server Key Vault Key for a server
        /// </summary>
        /// <param name="resourceGroupName">Name of resource group</param>
        /// <param name="serverName">Name of SQL server</param>
        /// <param name="keyId">KeyId of the Server Key Vault Key</param>
        /// <returns>The Server Key Vault Key</returns>
        public AzureSqlServerKeyVaultKeyModel Get(string resourceGroupName, string serverName, string keyId)
        {
            string keyName = AzureSqlServerKeyVaultKeyModel.CreateServerKeyNameFromKeyId(keyId);
            var    resp    = Communicator.Get(resourceGroupName, serverName, keyName, Util.GenerateTracingId());

            return(CreateServerKeyModelFromResponse(resourceGroupName, serverName, keyName, resp));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructs the model to send to the update API
        /// </summary>
        /// <param name="model">The result of the get operation</param>
        /// <returns>The model to send to the update</returns>
        protected override IEnumerable <Model.AzureSqlServerTransparentDataEncryptionProtectorModel> ApplyUserInputToModel(IEnumerable <Model.AzureSqlServerTransparentDataEncryptionProtectorModel> model)
        {
            List <Model.AzureSqlServerTransparentDataEncryptionProtectorModel> newEntity = new List <Model.AzureSqlServerTransparentDataEncryptionProtectorModel>();

            newEntity.Add(new Model.AzureSqlServerTransparentDataEncryptionProtectorModel()
            {
                ResourceGroupName = this.ResourceGroupName,
                ServerName        = this.ServerName,
                Type = this.Type,
                ServerKeyVaultKeyName = AzureSqlServerKeyVaultKeyModel.CreateServerKeyNameFromKeyId(this.KeyId),
                KeyId = this.KeyId
            });
            return(newEntity);
        }
        /// <summary>
        /// Generates the model from user input.
        /// </summary>
        /// <param name="model">This is null since the model doesn't exist yet</param>
        /// <returns>The generated model from user input</returns>
        protected override IEnumerable <AzureSqlServerKeyVaultKeyModel> ApplyUserInputToModel(IEnumerable <AzureSqlServerKeyVaultKeyModel> model)
        {
            List <AzureSqlServerKeyVaultKeyModel> newEntity = new List <AzureSqlServerKeyVaultKeyModel>();

            newEntity.Add(new AzureSqlServerKeyVaultKeyModel()
            {
                ResourceGroupName = this.ResourceGroupName,
                ServerName        = this.ServerName,
                ServerKeyName     = AzureSqlServerKeyVaultKeyModel.CreateServerKeyNameFromKeyId(this.KeyId),
                Uri  = this.KeyId,
                Type = AzureSqlServerKeyVaultKeyModel.ServerKeyType.AzureKeyVault
            });

            return(newEntity);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Deletes a Server Key Vault Key
        /// </summary>
        /// <param name="resourceGroupName">Name of resource group</param>
        /// <param name="serverName">Name of SQL server</param>
        /// <param name="keyId">KeyId of the Server Key Vault Key</param>
        public void Delete(string resourceGroupName, string serverName, string keyId)
        {
            string keyName = AzureSqlServerKeyVaultKeyModel.CreateServerKeyNameFromKeyId(keyId);

            Communicator.Delete(resourceGroupName, serverName, keyName, Util.GenerateTracingId());
        }