| | 1 | | // Copyright (c) Microsoft Corporation. All rights reserved. |
| | 2 | | // Licensed under the MIT License. |
| | 3 | |
|
| | 4 | | using System; |
| | 5 | | using System.Collections.Generic; |
| | 6 | |
|
| | 7 | | namespace Azure.Security.KeyVault.Administration.Models |
| | 8 | | { |
| | 9 | | /// <summary> |
| | 10 | | /// A factory class which constructs model classes for mocking purposes. |
| | 11 | | /// </summary> |
| | 12 | | public static class KeyVaultModelFactory |
| | 13 | | { |
| | 14 | | /// <summary> |
| | 15 | | /// Initializes a new instance of RoleDefinition. |
| | 16 | | /// </summary> |
| | 17 | | /// <param name="id"> The role definition ID. </param> |
| | 18 | | /// <param name="name"> The role definition name. </param> |
| | 19 | | /// <param name="type"> The role definition type. </param> |
| | 20 | | /// <param name="roleName"> The role name. </param> |
| | 21 | | /// <param name="description"> The role definition description. </param> |
| | 22 | | /// <param name="roleType"> The role type. </param> |
| | 23 | | /// <param name="permissions"> Role definition permissions. </param> |
| | 24 | | /// <param name="assignableScopes"> Role definition assignable scopes. </param> |
| | 25 | | public static RoleDefinition RoleDefinition(string id, string name, string type, string roleName, string descrip |
| 0 | 26 | | new RoleDefinition(id, name, type, roleName, description, roleType, permissions, assignableScopes); |
| | 27 | |
|
| | 28 | | /// <summary> |
| | 29 | | /// Initializes a new instance of RoleAssignment. |
| | 30 | | /// </summary> |
| | 31 | | /// <param name="id"> The role assignment ID. </param> |
| | 32 | | /// <param name="name"> The role assignment name. </param> |
| | 33 | | /// <param name="type"> The role assignment type. </param> |
| | 34 | | /// <param name="properties"> Role assignment properties. </param> |
| | 35 | | public static RoleAssignment RoleAssignment(string id, string name, string type, RoleAssignmentPropertiesWithSco |
| 0 | 36 | | new RoleAssignment(id, name, type, properties); |
| | 37 | |
|
| | 38 | | /// <summary> |
| | 39 | | /// Initializes a new instance of a FullRestoreOperation for mocking purposes. |
| | 40 | | /// </summary> |
| | 41 | | /// <param name="response">The <see cref="Response" /> that will be returned from <see cref="RestoreOperation.Ge |
| | 42 | | /// <param name="client">An instance of <see cref="KeyVaultBackupClient" />.</param> |
| | 43 | | /// <param name="id"> Identifier for the restore operation.</param> |
| | 44 | | /// <param name="startTime"> The start time of the restore operation.</param> |
| | 45 | | /// <param name="endTime"> The end time of the restore operation.</param> |
| | 46 | | /// <param name="errorMessage">The error message generated from the operation, if any.</param> |
| | 47 | | public static RestoreOperation RestoreOperation(Response response, KeyVaultBackupClient client, string id, DateT |
| 0 | 48 | | new RestoreOperation(new RestoreDetailsInternal( |
| 0 | 49 | | null, |
| 0 | 50 | | null, |
| 0 | 51 | | errorMessage == null ? null : new KeyVaultServiceError(string.Empty, errorMessage, null), |
| 0 | 52 | | id, |
| 0 | 53 | | startTime, |
| 0 | 54 | | endTime), response, client); |
| | 55 | |
|
| | 56 | | /// <summary> |
| | 57 | | /// Initializes a new instance of a FullBackupOperation for mocking purposes. |
| | 58 | | /// </summary> |
| | 59 | | /// <param name="response">The <see cref="Response" /> that will be returned from <see cref="BackupOperation.Get |
| | 60 | | /// <param name="client">An instance of <see cref="KeyVaultBackupClient" />.</param> |
| | 61 | | /// <param name="id"> Identifier for the restore operation.</param> |
| | 62 | | /// <param name="blobContainerUri">The Blob Container Uri containing the backup.</param> |
| | 63 | | /// <param name="startTime"> The start time of the restore operation.</param> |
| | 64 | | /// <param name="endTime"> The end time of the restore operation.</param> |
| | 65 | | /// <param name="errorMessage">The error message generated from the operation, if any.</param> |
| | 66 | | public static BackupOperation BackupOperation(Response response, KeyVaultBackupClient client, string id, Uri blo |
| 0 | 67 | | new BackupOperation(new FullBackupDetailsInternal( |
| 0 | 68 | | null, |
| 0 | 69 | | null, |
| 0 | 70 | | errorMessage == null ? null : new KeyVaultServiceError(string.Empty, errorMessage, null), |
| 0 | 71 | | startTime, |
| 0 | 72 | | endTime, |
| 0 | 73 | | id, |
| 0 | 74 | | blobContainerUri.AbsoluteUri), response, client); |
| | 75 | | } |
| | 76 | | } |