Example #1
0
        public virtual Response <Key> CreateKey(string name, KeyType keyType, KeyCreateOptions keyOptions = default, CancellationToken cancellationToken = default)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException($"{nameof(name)} can't be empty or null");
            }
            if (keyType == default)
            {
                throw new ArgumentNullException(nameof(keyType));
            }

            var parameters = new KeyRequestParameters(keyType, keyOptions);

            return(SendRequest(HttpPipelineMethod.Put, parameters, () => new Key(name), cancellationToken, KeysPath, name, "create"));
        }
        /// <summary>
        /// Creates and stores a new key in Key Vault.
        /// </summary>
        /// <remarks>
        /// The create key operation can be used to create any key type in Azure Key
        /// Vault. If the named key already exists, Azure Key Vault creates a new
        /// version of the key. It requires the keys/create permission.
        /// </remarks>
        /// <param name="name">The name of the key.</param>
        /// <param name="keyType">The type of key to create. See <see cref="KeyType"/> for valid values.</param>
        /// <param name="keyOptions">Specific attributes with information about the key.</param>
        /// <param name="cancellationToken">A <see cref="CancellationToken"/> controlling the request lifetime.</param>
        public virtual async Task <Response <Key> > CreateKeyAsync(string name, KeyType keyType, KeyCreateOptions keyOptions = default, CancellationToken cancellationToken = default)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException($"{nameof(name)} can't be empty or null");
            }
            if (keyType == default)
            {
                throw new ArgumentNullException(nameof(keyType));
            }

            var parameters = new KeyRequestParameters(keyType, keyOptions);

            return(await SendRequestAsync(RequestMethod.Post, parameters, () => new Key(name), cancellationToken, KeysPath, name, "/create").ConfigureAwait(false));
        }
Example #3
0
        public virtual async Task <Response <Key> > CreateKeyAsync(string name, KeyType keyType, KeyCreateOptions keyOptions = default, CancellationToken cancellationToken = default)
        {
            await Task.CompletedTask;

            throw new NotImplementedException();
        }
Example #4
0
 public virtual Response <Key> CreateKey(string name, KeyType keyType, KeyCreateOptions keyOptions = default, CancellationToken cancellationToken = default)
 {
     throw new NotImplementedException();
 }
Example #5
0
        public virtual async Task <Response <Key> > CreateKeyAsync(KeyCreateOptions options, CancellationToken cancellationToken = default)
        {
            await Task.CompletedTask;

            throw new NotImplementedException();
        }
Example #6
0
 public virtual Response <Key> CreateKey(KeyCreateOptions options, CancellationToken cancellationToken = default)
 {
     throw new NotImplementedException();
 }