| | | 1 | | // <auto-generated> |
| | | 2 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | | 3 | | // Licensed under the MIT License. See License.txt in the project root for |
| | | 4 | | // license information. |
| | | 5 | | // |
| | | 6 | | // Code generated by Microsoft (R) AutoRest Code Generator. |
| | | 7 | | // Changes may cause incorrect behavior and will be lost if the code is |
| | | 8 | | // regenerated. |
| | | 9 | | // </auto-generated> |
| | | 10 | | |
| | | 11 | | namespace Microsoft.Azure.CognitiveServices.Vision.Face.Models |
| | | 12 | | { |
| | | 13 | | using Microsoft.Rest; |
| | | 14 | | using Newtonsoft.Json; |
| | | 15 | | using System.Linq; |
| | | 16 | | |
| | | 17 | | /// <summary> |
| | | 18 | | /// Request body for applying snapshot operation. |
| | | 19 | | /// </summary> |
| | | 20 | | public partial class ApplySnapshotRequest |
| | | 21 | | { |
| | | 22 | | /// <summary> |
| | | 23 | | /// Initializes a new instance of the ApplySnapshotRequest class. |
| | | 24 | | /// </summary> |
| | 8 | 25 | | public ApplySnapshotRequest() |
| | | 26 | | { |
| | | 27 | | CustomInit(); |
| | 8 | 28 | | } |
| | | 29 | | |
| | | 30 | | /// <summary> |
| | | 31 | | /// Initializes a new instance of the ApplySnapshotRequest class. |
| | | 32 | | /// </summary> |
| | | 33 | | /// <param name="objectId">User specified target object id to be |
| | | 34 | | /// created from the snapshot.</param> |
| | | 35 | | /// <param name="mode">Snapshot applying mode. Currently only CreateNew |
| | | 36 | | /// is supported, which means the apply operation will fail if target |
| | | 37 | | /// subscription already contains an object of same type and using the |
| | | 38 | | /// same objectId. Users can specify the "objectId" in request body to |
| | | 39 | | /// avoid such conflicts. Possible values include: 'CreateNew'</param> |
| | 0 | 40 | | public ApplySnapshotRequest(string objectId, SnapshotApplyMode mode = default(SnapshotApplyMode)) |
| | | 41 | | { |
| | 0 | 42 | | ObjectId = objectId; |
| | 0 | 43 | | Mode = mode; |
| | | 44 | | CustomInit(); |
| | 0 | 45 | | } |
| | | 46 | | |
| | | 47 | | /// <summary> |
| | | 48 | | /// An initialization method that performs custom operations like setting defaults |
| | | 49 | | /// </summary> |
| | | 50 | | partial void CustomInit(); |
| | | 51 | | |
| | | 52 | | /// <summary> |
| | | 53 | | /// Gets or sets user specified target object id to be created from the |
| | | 54 | | /// snapshot. |
| | | 55 | | /// </summary> |
| | | 56 | | [JsonProperty(PropertyName = "objectId")] |
| | 16 | 57 | | public string ObjectId { get; set; } |
| | | 58 | | |
| | | 59 | | /// <summary> |
| | | 60 | | /// Gets or sets snapshot applying mode. Currently only CreateNew is |
| | | 61 | | /// supported, which means the apply operation will fail if target |
| | | 62 | | /// subscription already contains an object of same type and using the |
| | | 63 | | /// same objectId. Users can specify the "objectId" in request body to |
| | | 64 | | /// avoid such conflicts. Possible values include: 'CreateNew' |
| | | 65 | | /// </summary> |
| | | 66 | | [JsonProperty(PropertyName = "mode")] |
| | 16 | 67 | | public SnapshotApplyMode Mode { get; set; } |
| | | 68 | | |
| | | 69 | | /// <summary> |
| | | 70 | | /// Validate the object. |
| | | 71 | | /// </summary> |
| | | 72 | | /// <exception cref="ValidationException"> |
| | | 73 | | /// Thrown if validation fails |
| | | 74 | | /// </exception> |
| | | 75 | | public virtual void Validate() |
| | | 76 | | { |
| | 0 | 77 | | if (ObjectId == null) |
| | | 78 | | { |
| | 0 | 79 | | throw new ValidationException(ValidationRules.CannotBeNull, "ObjectId"); |
| | | 80 | | } |
| | 0 | 81 | | if (ObjectId != null) |
| | | 82 | | { |
| | 0 | 83 | | if (ObjectId.Length > 64) |
| | | 84 | | { |
| | 0 | 85 | | throw new ValidationException(ValidationRules.MaxLength, "ObjectId", 64); |
| | | 86 | | } |
| | 0 | 87 | | if (!System.Text.RegularExpressions.Regex.IsMatch(ObjectId, "^[a-z0-9-_]+$")) |
| | | 88 | | { |
| | 0 | 89 | | throw new ValidationException(ValidationRules.Pattern, "ObjectId", "^[a-z0-9-_]+$"); |
| | | 90 | | } |
| | | 91 | | } |
| | 0 | 92 | | } |
| | | 93 | | } |
| | | 94 | | } |