| | 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.Collections; |
| | 16 | | using System.Collections.Generic; |
| | 17 | | using System.Linq; |
| | 18 | |
|
| | 19 | | /// <summary> |
| | 20 | | /// Request body for taking snapshot operation. |
| | 21 | | /// </summary> |
| | 22 | | public partial class TakeSnapshotRequest |
| | 23 | | { |
| | 24 | | /// <summary> |
| | 25 | | /// Initializes a new instance of the TakeSnapshotRequest class. |
| | 26 | | /// </summary> |
| 8 | 27 | | public TakeSnapshotRequest() |
| | 28 | | { |
| | 29 | | CustomInit(); |
| 8 | 30 | | } |
| | 31 | |
|
| | 32 | | /// <summary> |
| | 33 | | /// Initializes a new instance of the TakeSnapshotRequest class. |
| | 34 | | /// </summary> |
| | 35 | | /// <param name="type">User specified type for the source object to |
| | 36 | | /// take snapshot from. Currently FaceList, PersonGroup, LargeFaceList |
| | 37 | | /// and LargePersonGroup are supported. Possible values include: |
| | 38 | | /// 'FaceList', 'LargeFaceList', 'LargePersonGroup', |
| | 39 | | /// 'PersonGroup'</param> |
| | 40 | | /// <param name="objectId">User specified source object id to take |
| | 41 | | /// snapshot from.</param> |
| | 42 | | /// <param name="applyScope">User specified array of target Face |
| | 43 | | /// subscription ids for the snapshot. For each snapshot, only |
| | 44 | | /// subscriptions included in the applyScope of Snapshot - Take can |
| | 45 | | /// apply it.</param> |
| | 46 | | /// <param name="userData">User specified data about the snapshot for |
| | 47 | | /// any purpose. Length should not exceed 16KB.</param> |
| 0 | 48 | | public TakeSnapshotRequest(SnapshotObjectType type, string objectId, IList<System.Guid> applyScope, string userD |
| | 49 | | { |
| 0 | 50 | | Type = type; |
| 0 | 51 | | ObjectId = objectId; |
| 0 | 52 | | ApplyScope = applyScope; |
| 0 | 53 | | UserData = userData; |
| | 54 | | CustomInit(); |
| 0 | 55 | | } |
| | 56 | |
|
| | 57 | | /// <summary> |
| | 58 | | /// An initialization method that performs custom operations like setting defaults |
| | 59 | | /// </summary> |
| | 60 | | partial void CustomInit(); |
| | 61 | |
|
| | 62 | | /// <summary> |
| | 63 | | /// Gets or sets user specified type for the source object to take |
| | 64 | | /// snapshot from. Currently FaceList, PersonGroup, LargeFaceList and |
| | 65 | | /// LargePersonGroup are supported. Possible values include: |
| | 66 | | /// 'FaceList', 'LargeFaceList', 'LargePersonGroup', 'PersonGroup' |
| | 67 | | /// </summary> |
| | 68 | | [JsonProperty(PropertyName = "type")] |
| 16 | 69 | | public SnapshotObjectType Type { get; set; } |
| | 70 | |
|
| | 71 | | /// <summary> |
| | 72 | | /// Gets or sets user specified source object id to take snapshot from. |
| | 73 | | /// </summary> |
| | 74 | | [JsonProperty(PropertyName = "objectId")] |
| 16 | 75 | | public string ObjectId { get; set; } |
| | 76 | |
|
| | 77 | | /// <summary> |
| | 78 | | /// Gets or sets user specified array of target Face subscription ids |
| | 79 | | /// for the snapshot. For each snapshot, only subscriptions included in |
| | 80 | | /// the applyScope of Snapshot - Take can apply it. |
| | 81 | | /// </summary> |
| | 82 | | [JsonProperty(PropertyName = "applyScope")] |
| 16 | 83 | | public IList<System.Guid> ApplyScope { get; set; } |
| | 84 | |
|
| | 85 | | /// <summary> |
| | 86 | | /// Gets or sets user specified data about the snapshot for any |
| | 87 | | /// purpose. Length should not exceed 16KB. |
| | 88 | | /// </summary> |
| | 89 | | [JsonProperty(PropertyName = "userData")] |
| 16 | 90 | | public string UserData { get; set; } |
| | 91 | |
|
| | 92 | | /// <summary> |
| | 93 | | /// Validate the object. |
| | 94 | | /// </summary> |
| | 95 | | /// <exception cref="ValidationException"> |
| | 96 | | /// Thrown if validation fails |
| | 97 | | /// </exception> |
| | 98 | | public virtual void Validate() |
| | 99 | | { |
| 0 | 100 | | if (ObjectId == null) |
| | 101 | | { |
| 0 | 102 | | throw new ValidationException(ValidationRules.CannotBeNull, "ObjectId"); |
| | 103 | | } |
| 0 | 104 | | if (ApplyScope == null) |
| | 105 | | { |
| 0 | 106 | | throw new ValidationException(ValidationRules.CannotBeNull, "ApplyScope"); |
| | 107 | | } |
| 0 | 108 | | if (ObjectId != null) |
| | 109 | | { |
| 0 | 110 | | if (ObjectId.Length > 64) |
| | 111 | | { |
| 0 | 112 | | throw new ValidationException(ValidationRules.MaxLength, "ObjectId", 64); |
| | 113 | | } |
| 0 | 114 | | if (!System.Text.RegularExpressions.Regex.IsMatch(ObjectId, "^[a-z0-9-_]+$")) |
| | 115 | | { |
| 0 | 116 | | throw new ValidationException(ValidationRules.Pattern, "ObjectId", "^[a-z0-9-_]+$"); |
| | 117 | | } |
| | 118 | | } |
| 0 | 119 | | if (UserData != null) |
| | 120 | | { |
| 0 | 121 | | if (UserData.Length > 16384) |
| | 122 | | { |
| 0 | 123 | | throw new ValidationException(ValidationRules.MaxLength, "UserData", 16384); |
| | 124 | | } |
| | 125 | | } |
| 0 | 126 | | } |
| | 127 | | } |
| | 128 | | } |