-
Notifications
You must be signed in to change notification settings - Fork 4.5k
/
KeyCreateParameters.cs
122 lines (111 loc) · 4.33 KB
/
KeyCreateParameters.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
// <auto-generated>
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See License.txt in the project root for
// license information.
//
// Code generated by Microsoft (R) AutoRest Code Generator.
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
// </auto-generated>
namespace Microsoft.Azure.KeyVault.Models
{
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// The key create parameters.
/// </summary>
public partial class KeyCreateParameters
{
/// <summary>
/// Initializes a new instance of the KeyCreateParameters class.
/// </summary>
public KeyCreateParameters()
{
CustomInit();
}
/// <summary>
/// Initializes a new instance of the KeyCreateParameters class.
/// </summary>
/// <param name="kty">The type of key to create. For valid values, see
/// Microsoft.Azure.KeyVault.WebKey.JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA',
/// 'RSA-HSM', 'oct'</param>
/// <param name="keySize">The key size in bits. For example: 2048,
/// 3072, or 4096 for RSA.</param>
/// <param name="tags">Application specific metadata in the form of
/// key-value pairs.</param>
/// <param name="curve">Elliptic curve name. For valid values, see
/// Microsoft.Azure.KeyVault.WebKey.JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384',
/// 'P-521', 'P-256K'</param>
public KeyCreateParameters(string kty, int? keySize = default(int?), IList<string> keyOps = default(IList<string>), KeyAttributes keyAttributes = default(KeyAttributes), IDictionary<string, string> tags = default(IDictionary<string, string>), string curve = default(string))
{
Kty = kty;
KeySize = keySize;
KeyOps = keyOps;
KeyAttributes = keyAttributes;
Tags = tags;
Curve = curve;
CustomInit();
}
/// <summary>
/// An initialization method that performs custom operations like setting defaults
/// </summary>
partial void CustomInit();
/// <summary>
/// Gets or sets the type of key to create. For valid values, see
/// Microsoft.Azure.KeyVault.WebKey.JsonWebKeyType. Possible values include: 'EC', 'EC-HSM', 'RSA',
/// 'RSA-HSM', 'oct'
/// </summary>
[JsonProperty(PropertyName = "kty")]
public string Kty { get; set; }
/// <summary>
/// Gets or sets the key size in bits. For example: 2048, 3072, or 4096
/// for RSA.
/// </summary>
[JsonProperty(PropertyName = "key_size")]
public int? KeySize { get; set; }
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "key_ops")]
public IList<string> KeyOps { get; set; }
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "attributes")]
public KeyAttributes KeyAttributes { get; set; }
/// <summary>
/// Gets or sets application specific metadata in the form of key-value
/// pairs.
/// </summary>
[JsonProperty(PropertyName = "tags")]
public IDictionary<string, string> Tags { get; set; }
/// <summary>
/// Gets or sets elliptic curve name. For valid values, see
/// Microsoft.Azure.KeyVault.WebKey.JsonWebKeyCurveName. Possible values include: 'P-256', 'P-384',
/// 'P-521', 'P-256K'
/// </summary>
[JsonProperty(PropertyName = "crv")]
public string Curve { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Kty == null)
{
throw new ValidationException(ValidationRules.CannotBeNull, "Kty");
}
if (Kty != null)
{
if (Kty.Length < 1)
{
throw new ValidationException(ValidationRules.MinLength, "Kty", 1);
}
}
}
}
}